public class AssertExpression extends ExpressionOperation implements ValueAssertion<ScriptOperation.Context>
Tuple
values. Any Tuple that
returns true for the given expression pass the assertion. This Assertion
is based on the Janino compiler.
Specifically this filter 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
Further, the types of the tuple elements will be coerced into the given parameterTypes. Regardless of the actual tuple element values, they will be converted to the types expected by the expression.
ScriptOperation.Context
block, parameterNames, parameterTypes, returnType
fieldDeclaration, numArgs, trace
Constructor and Description |
---|
AssertExpression(Fields fieldDeclaration,
java.lang.String expression,
java.lang.String[] parameterNames,
java.lang.Class[] parameterTypes)
Constructor AssertExpression creates a new AssertExpression instance.
|
AssertExpression(java.lang.String expression,
java.lang.Class parameterType)
Constructor ExpressionFilter creates a new ExpressionFilter instance.
|
Modifier and Type | Method and Description |
---|---|
void |
doAssert(FlowProcess flowProcess,
ValueAssertionCall<ScriptOperation.Context> assertionCall) |
boolean |
supportsPlannerLevel(PlannerLevel plannerLevel) |
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={"expression","parameterType"}) public AssertExpression(java.lang.String expression, java.lang.Class parameterType)
expression
- of type StringparameterType
- of type Class@ConstructorProperties(value={"fieldDeclaration","expression","parameterNames","parameterTypes"}) public AssertExpression(Fields fieldDeclaration, java.lang.String expression, java.lang.String[] parameterNames, java.lang.Class[] parameterTypes)
fieldDeclaration
- of type Fieldsexpression
- of type StringparameterNames
- of type String[]parameterTypes
- of type Class[]public boolean supportsPlannerLevel(PlannerLevel plannerLevel)
supportsPlannerLevel
in interface PlannedOperation<ScriptOperation.Context>
public void doAssert(FlowProcess flowProcess, ValueAssertionCall<ScriptOperation.Context> assertionCall)
doAssert
in interface ValueAssertion<ScriptOperation.Context>
Copyright © 2007-2017 Cascading Maintainers. All Rights Reserved.