Basic Java type in the context of the ILOG® JRules connector is
a Java type that can be mapped directly to a link column.
Basic Java types
Basic Java types are:
- Primitive types: int, short, long, double, float, boolean, byte,
char
- Wrapper classes for primitive types: java.lang.Integer, java.lang.Short,
java.lang.Long, java.lang.Double, java.lang.Float, java.lang.Boolean,
java.lang.Byte, java.lang.Character
- String type: java.lang.String
- Date/time types: java.util.Date, java.util.Calendar, java.sql.Date,
java.sql.Time, java.sql.Timestamp
- Numeric types: java.math.BigInteger, java.math.BigDecimal
When a ruleset parameter is an XML parameter or a Java
parameter of basic Java type, the parameter is mapped directly to
a link column as follows:
- If the parameter is mapped to a column on an input link, then
that parameter must be an IN or IN_OUT parameter. The column represents
the value to be passed to the parameter when the ruleset is invoked.
- If the parameter is mapped to a column on an output link, then
that parameter must be an OUT or IN_OUT parameter. The column represents
the value returned by the ruleset for the parameter, when the ruleset
is invoked.
When the ruleset parameter does not map directly to a
link column, the ruleset constructs that map to the link columns are
the return values and arguments of basic methods of the Java class
associated with the ruleset parameter.
Basic Java methods
A basic Java method meets
one of the following conditions:
- It is a constructor method or a method that does not return a
value (void method), and all its arguments are of basic Java types.
The method arguments are mapped to the input link column associated
with the ruleset parameter in whose class the method is defined. The
ruleset parameter must be an IN or IN_OUT parameter. The columns values
are passed to the method arguments when invoking the method on the
respective ruleset parameter object before invoking the ruleset and
passing the parameter to it.
- It is a method that does not contain any arguments and its return
value is a basic Java type. The method return value maps to a column
on the output link associated with the ruleset parameter in whose
class type that method is defined. The ruleset parameter must be an
OUT or IN_OUT parameter. The column represents the return value to
be retrieved from the method after the ruleset containing the parameter
is invoked and the method is invoked on that ruleset parameter object.
The configuration wizard handles ruleset parameters associated
with Java array types as if they were of the corresponding non-array
types. When the job is run, the stage typically collects multiple
records on the link to prepare the ruleset parameter value. The data
records on the link associated with that ruleset parameter correspond
to Java objects that are stored in the array which as a whole corresponds
to the ruleset parameter value. However, if a ruleset parameter is
of char[] and byte[] Java array types, then it corresponds to a single
field value from a single record on the link, as follows:
- If the column is of character data type such as VarChar or NVarChar,
then the characters of the text field value are mapped to the char
elements of the char[] array for the ruleset parameter.
- If the column is of a binary data type such as VarBinary then
the bytes of the corresponding binary field value map to the byte
elements of the byte[] array.