Perform action (<perform> element)
The Perform action invokes a method belonging to a Java class that you have imported (see Creating an imported type for a Java class).
You can invoke a method in many other contexts besides the Perform action. However, the Perform action is useful in certain scenarios, for example, when you want to invoke a method that does not return a value.
Some of the contexts, other than the Perform action, in which you
can invoke a method are as follows:
- You can invoke a method and assign the return value to a variable by using the Update variable action. The variable that receives the return value can be either a variable belonging to a standard type (boolean, integer, string, double) or a variable belonging to an imported type (for example, a variable named $objTmp$ that belongs to the imported type Object, based on the Java class Object).
- You can invoke a method and use the return value as a parameter in a macro action by specifying the method call in the field for the parameter. For example, in the Row parameter of an Extract action you can use a method call that returns an integer value. The macro runtime sees that the parameter is a method call , invokes the method, and uses the integer return value as the value of the Row parameter.
- You can invoke a method as part of any expression by using the method call as a term in the expression. When the macro runtime evaluates the expression, it sees that the term is a method call, invokes the method, and uses the value of the method (for example, a string) as the value of the term.
- You can invoke a method and use the return value as the initial value of a variable that you have just declared.