public class ExpressionFunction extends ExpressionOperation implements Function<ScriptOperation.Context>
Tuple
values. This Function
is based on the Janino compiler.
Specifically this function uses the ExpressionEvaluator
, thus the syntax from that class is inherited here.
An expression may use field names directly as parameters in the expression, or field positions with the syntax
"$n", where n is an integer.
Given an argument tuple with the fields "a" and "b", the following expression returns true: a + b == $0 + $1
ScriptOperation.Context
block, parameterNames, parameterTypes, returnType
fieldDeclaration, numArgs, trace
Constructor and Description |
---|
ExpressionFunction(Fields fieldDeclaration,
String expression)
Constructor ExpressionFunction creates a new ExpressionFunction instance.
|
ExpressionFunction(Fields fieldDeclaration,
String expression,
Class parameterType)
Constructor ExpressionFunction creates a new ExpressionFunction instance.
|
ExpressionFunction(Fields fieldDeclaration,
String expression,
String[] parameterNames,
Class[] parameterTypes)
Constructor ExpressionFunction creates a new ExpressionFunction instance.
|
Modifier and Type | Method and Description |
---|---|
void |
operate(FlowProcess flowProcess,
FunctionCall<ScriptOperation.Context> functionCall)
Method operate provides the implementation of this Function.
|
getEvaluator, getExpression, guessParameterNames
equals, evaluate, getBlock, getParameterNames, getParameterTypes, getReturnType, hashCode, prepare
cleanup, flush, getFieldDeclaration, getNumArgs, getTrace, isSafe, printOperationInternal, toString, toStringInternal
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
cleanup, flush, getFieldDeclaration, getNumArgs, isSafe, prepare
@ConstructorProperties(value={"fieldDeclaration","expression"}) public ExpressionFunction(Fields fieldDeclaration, String expression)
a + b
. The type of a
and b
will be inherited from the incoming argument fields.
Or, if the incoming argument selector is Fields.NONE
, an expression using only static method calls
or constants can be used.
This is useful when inserting random numbers for example, (int) (Math.random() * Integer.MAX_VALUE)
.fieldDeclaration
- of type Fieldsexpression
- of type String@ConstructorProperties(value={"fieldDeclaration","expression","parameterType"}) public ExpressionFunction(Fields fieldDeclaration, String expression, Class parameterType)
fieldDeclaration
- of type Fieldsexpression
- of type StringparameterType
- of type Class@ConstructorProperties(value={"fieldDeclaration","expression","parameterNames","parameterTypes"}) public ExpressionFunction(Fields fieldDeclaration, String expression, String[] parameterNames, Class[] parameterTypes)
fieldDeclaration
- of type Fieldsexpression
- of type StringparameterNames
- of type String[]parameterTypes
- of type Class[]public void operate(FlowProcess flowProcess, FunctionCall<ScriptOperation.Context> functionCall)
Function
operate
in interface Function<ScriptOperation.Context>
flowProcess
- of type FlowProcessfunctionCall
- of type FunctionCallCopyright © 2007-2015 Concurrent, Inc. All Rights Reserved.