Representing a Parameter as Its Primitive Type

The default setting is to represent the parameter as its primitive type.

The following table shows these settings for Jython and DynamicJava:

Data Type Jython Type DynamicJava
Real float double
Integer long long
Boolean bool boolean
String unicode java.lang.String
File java.io.File java.io.File

Jython maps the Java data types to the closest matching Python data type. You do not need to know the Python type of a value, since the Python types behave almost the same as the Java types. The Python types do have methods, which the Java types (other than String) do not have. Furthermore, the methods of the Python type unicode are very different from those of java.lang.String, even though both are strings of unicode characters.

The value of the parameter is copied into the script variable before the script starts, and the value of the script variable is copied back into the parameter after the script finishes (for parameters with mode Output and In/Out only).

Array parameters become an array of the associated primitive type. For example, an array parameter of type real with one dimension becomes a Java array of type double[]. In Jython, these arrays have the Python type array, which is subtly different from the normal Python types tuple and list.

Standard usage for a real ScalarParameter sum and array parameter arr would be as follows:

  • Jython: sum = sum + arr[i]

  • DynamicJava: sum = sum + arr[(int)i];