Developer Transformation Guide > Java Transformation API Reference > defineJExpression
  

defineJExpression

Defines an expression, including the expression string and input parameters. Arguments for the defineJExpression method include an array of JExprParamMetadata objects that contains the input parameters and a string value that defines the expression syntax.
Use the following syntax:
defineJExpression(
    String expression,
    Object[] paramMetadataArray
    );
The following table describes the parameters:
Parameter
Type
Datatype
Description
expression
Input
String
String that represents the expression.
paramMetadataArray
Input
Object[]
Array of JExprParaMetadata objects that contain the input parameters for the expression.
You can add the defineJExpression method to the Java code on any code entry tab except the Imports and Functions tabs.
To use the defineJExpression method, you must instantiate an array of JExprParamMetadata objects that represent the input parameters for the expression. You set the metadata values for the parameters and pass the array as a parameter to the defineJExpression method.
For example, the following Java code creates an expression to look up the value of two strings:
JExprParaMetadata params[] = new JExprParamMetadata[2];
params[0] = new JExprParamMetadata(EDataType.STRING, 20, 0);
params[1] = new JExprParamMetadata(EDataType.STRING, 20, 0);
defineJExpression(":lkp.mylookup(x1,x2)",params);