Java Class Connector (Magic xpi 4.6)
This technical note demonstrates how to use the Java Class Connector utility.
The Java Class Connector utility lets you access and manipulate Java classes and objects. Accessing Java Class objects is achieved by selecting the required objects, such as Instance Methods, Instance Variables, Static Methods, or Static Variables, and receiving the returns from each. This allows components in your flow to access the Java class.
This example describes how to create dynamic arrays using the java.util.Vector class.
-
Drag a Java Class Connector utility to your flow.
-
Click Configuration to open the Configuration dialog box.
-
In the Class name enter java.util.Vector.
-
In the Constructor drop-down list select ()V, and then click Select.
Note:
|
You do not need to define the constructor’s parameters to create the new object.
|
-
Next to Object reference, click to open the Variables List. Select a variable to hold the object, and then click Select.
-
Click Method to open the Select Method screen.
-
Click New and from the drop-down list, select IM_setSize(I)V as your method. This method sets the vector size.
-
In the Method parameters section, enter a numeric value to set the size of the vector.
-
Click New again to add another method.
-
From the drop-down list, select IM_size()I as your method. This method returns the vector size.
-
Next to Return value, click to select the variable that will hold the method’s answer.
-
Click OK three times to complete the configuration.
-
Drag a Save Message utility to your flow.
-
To the right of the Messages field, click to open the Expression Editor.
-
Enter your second method’s Return value and then use the Str function to convert it to an Alpha string.
-
Run the project.