Dynamic Java Action

The Dynamic Java Action allows you to call methods on a Java class you have created. Unlike the Java Action, the Dynamic Java Action does not require you to implement any specific interfaces in your code.

To use the Dynamic Java Action, just set the listener and listener signature, and (optionally) any arguments the method may require.

Properties

Argument Count

The total number of arguments expected by the method that this action is calling.

The argument count is dynamically generated based on the listener signature and cannot be updated. You can use the argument count to easily see how many arguments your listener is expecting.

Argument

The actual values that will be passed as arguments to the method that this action is calling.

The argument properties contains an indexed collection of values to be passed to the method. The first argument stored in the collection corresponds with the first argument in your listener signature, the second argument in the collection corresponds with the second in the signature, and so on.

To set the argument values, you will first need to set the listener signature property. The argument collection will then be initialized with an empty data set (the exact data types will be automatically determined based on the listener signature), which you can then edit to include the data you are planning to pass in.

The argument property supports variable substitution for passing along data from the flow chart (for example, to pass the result of another action as an argument to your listener).

Listener

The name (including the full package) of the listener class that this action will invoke – for example, mypackage.MyDynamicListener. Unlike the Java Action, the listener class for the Dynamic Java Action does not need to implement any Flux interfaces.

This property is used in conjunction with the listener signature to determine which class and method should be invoked when the Dynamic Java Action runs.

Listener Signature

The signature of the method on your listener class that this action will invoke when it executes. The listener signature property should include the method name and any arguments that the method might include.

For example, to invoke the main() method on the listener class, your listener signature property should be set to:

main(String[] args)

If, on the other hand, you wanted to invoke a method whose source code looked like:

public void doSomething(int arg1, String arg2) {
//  Your code here
}

Then your listener signature would be set to:

doSomething(int arg1, String arg2)

The Dynamic Java Action can invoke any public method on your listener class (including static methods and main() methods as demonstrated above).

When you set the listener signature, the argument count and argument properties are dynamically updated. You will need to be sure to set the listener signature property correctly before attempting to set any arguments on the property.

For example, if the listener signature was set to the doSomething() method as listed above, then the argument count would automatically be adjusted to "2", and the argument property would become editable with two arguments available: first, an integer (corresponding with the first argument in the signature), and second, a String (corresponding with the second argument in the signature).

Result

The Dynamic Java Action passes along the result returned from the method specified by the listener signature on the listener class. This means, for example, that if the method normally returns a String, the Dynamic Java Action itself would also return the same String value.

The result is automatically stored in the flow context variable "result", where subsequent actions or triggers can access it.

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.