but in '--context_param long_id=123', 123 is not a String or a Long or any other java type outside java (talend) you are not manipulating java type. a value for a param context , coming from shell script or a config.ini will always deen as a String (java type) in your application. |
Hey Kzone,
I've tried it with Long, Integer, and Boolean. Talend must be smart enough to convert it from a String to the appropriate java type.
For example, I have a job called TestCommandLineBoolean, with a context variable named "is_bool" of type Boolean
and one tJava with the following code:
if (context.is_bool != null) {
if (context.is_bool) {
System.out.println("is_bool is true");
} else {
System.out.println("is_bool is false");
}
} else if (context.is_bool == null) {
System.out.println("is_bool is null");
} else {
System.out.println("is_bool is neither!");
}
If I run it without passing a context parameter, is_bool defaults to false:
If I run it passing in "true", "True", or "TrUe", is_bool is set to true:
However, If I run it passing in "truetrue", "false", or "abcd", is_bool is set to (or remains) false:
So Talend appears to be converting it for me.
I would be curious to know if it also does the same for Dates, given it is entered in the proper format.
Regards,
Matthew