Passing Java Objects Between Java Code Activities
You may create instances of Java objects in your Java code or by using the Java Method or XML To Java activities. You can pass these Java objects using an output parameter to another activity later in the process definition. The Java Code activity receiving a Java object accepts the object into an input parameter and you must map the output Java object to the input object of the receiving Java Code object.
Passing objects between Java Code activities illustrates two Java code activities. The CreateObject activity creates a Java object and passes a reference to the object in the output parameter named out_object
. The UseObject activity defines an input parameter named in_object
of type ObjectReference
and maps the CreateObject activity’s output object reference to its input parameter of type ObjectReference
.
Figure 84: Passing objects between Java Code activities
The UseObject activity can invoke methods on the input object as it would for any other object. For example, if you want to call a method named getInteger()
that returns an integer, you would use the following code in the UseObject activity:
MyClass myObject = (MyClass) in_object;
int var = 0;
if (myObject != null) {
var = myObject.getInteger();
}