Transformations > Java transformation API reference > invokeJExpression
  

invokeJExpression

Invokes an expression and returns the value for the expression. Use only in advanced mode.
Use invokeJExpression in any section of the Java editor except Import Packages and Helper Code.
Use the following syntax:
(dataType)invokeJExpression(
                      String expression,
                      Object[] paramMetadataArray);
The following table describes the arguments:
Argument
Data Type
Input/Output
Description
dataType
-
Output
Data type that you want to cast the return value to. By default, the return data type is an object.
You can cast the return value to an integer, double, string, or byte[] data type.
expression
String
Input
String that represents the expression to invoke.
You must use the letter "x" and number the parameters consecutively. For example, if the invoked expression requires three parameters, name the parameters x1, x2, and x3.
paramMetadataArray
Object[]
Input
Array of objects that contains the input parameters for the invoked expression.
Use the following Java code to invoke the concat() method to concatenate the strings John and Smith:
(String)invokeJExpression("concat(x1,x2)", new Object [] { "John ", "Smith" });
The code returns the following string:
John Smith
Consider the following rules and guidelines for the invokeJExpression method: