Class AssertExpression

  extended by cascading.operation.BaseOperation<ExpressionOperation.Context>
      extended by cascading.operation.expression.ExpressionOperation
          extended by cascading.operation.assertion.AssertExpression
All Implemented Interfaces:
Assertion<ExpressionOperation.Context>, Operation<ExpressionOperation.Context>, PlannedOperation<ExpressionOperation.Context>, ValueAssertion<ExpressionOperation.Context>, Serializable

public class AssertExpression
extends ExpressionOperation
implements ValueAssertion<ExpressionOperation.Context>

Class AssertExpression dynamically resolves a given expression using argument Tuple values. Any Tuple that returns true for the given expression pass the assertion. This Assertion is based on the Janino compiler.

Specifially 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.

See Also:
Serialized Form

Nested Class Summary
Nested classes/interfaces inherited from class cascading.operation.expression.ExpressionOperation
Field Summary
Fields inherited from class cascading.operation.expression.ExpressionOperation
Fields inherited from class cascading.operation.BaseOperation
fieldDeclaration, numArgs, trace
Fields inherited from interface cascading.operation.Operation
Constructor Summary
AssertExpression(Fields fieldDeclaration, String expression, String[] parameterNames, Class[] parameterTypes)
          Constructor AssertExpression creates a new AssertExpression instance.
AssertExpression(String expression, Class parameterType)
          Constructor ExpressionFilter creates a new ExpressionFilter instance.
Method Summary
 void doAssert(FlowProcess flowProcess, ValueAssertionCall<ExpressionOperation.Context> assertionCall)
          Method doAssert performs the assertion.
 boolean supportsPlannerLevel(PlannerLevel plannerLevel)
Methods inherited from class cascading.operation.expression.ExpressionOperation
equals, evaluate, hashCode, prepare
Methods inherited from class cascading.operation.BaseOperation
cleanup, getFieldDeclaration, getNumArgs, getTrace, isSafe, printOperationInternal, toString, toStringInternal
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface cascading.operation.Operation
cleanup, getFieldDeclaration, getNumArgs, isSafe, prepare

Constructor Detail


public AssertExpression(String expression,
                                                   Class parameterType)
Constructor ExpressionFilter creates a new ExpressionFilter instance.

expression - of type String
parameterType - of type Class


public AssertExpression(Fields fieldDeclaration,
                                                   String expression,
                                                   String[] parameterNames,
                                                   Class[] parameterTypes)
Constructor AssertExpression creates a new AssertExpression instance.

fieldDeclaration - of type Fields
expression - of type String
parameterNames - of type String[]
parameterTypes - of type Class[]
Method Detail


public boolean supportsPlannerLevel(PlannerLevel plannerLevel)
Specified by:
supportsPlannerLevel in interface PlannedOperation<ExpressionOperation.Context>


public void doAssert(FlowProcess flowProcess,
                     ValueAssertionCall<ExpressionOperation.Context> assertionCall)
Description copied from interface: ValueAssertion
Method doAssert performs the assertion.

Specified by:
doAssert in interface ValueAssertion<ExpressionOperation.Context>
flowProcess - of type FlowProcess
assertionCall - of type ValueAssertionCall
See Also:

Copyright © 2007-2010 Concurrent, Inc. All Rights Reserved.