cascading.operation.expression
Class ExpressionFunction

java.lang.Object
  extended by cascading.operation.BaseOperation
      extended by cascading.operation.expression.ExpressionOperation
          extended by cascading.operation.expression.ExpressionFunction
All Implemented Interfaces:
Function, Operation, Serializable

public class ExpressionFunction
extends ExpressionOperation
implements Function

Class ExpressionFunction dynamically resolves a given expression using argument Tuple values. This Function is based on the Janino compiler.

Specifially 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

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

Field Summary
 
Fields inherited from class cascading.operation.expression.ExpressionOperation
expression, parameterTypes
 
Fields inherited from class cascading.operation.BaseOperation
fieldDeclaration, numArgs
 
Fields inherited from interface cascading.operation.Operation
ANY
 
Constructor Summary
ExpressionFunction(Fields fieldDeclaration, String expression, Class... parameterTypes)
          Constructor ExpressionFunction creates a new ExpressionFunction instance.
 
Method Summary
 void operate(TupleEntry input, TupleCollector outputCollector)
          Method operate provides the implementation of this Function.
 
Methods inherited from class cascading.operation.expression.ExpressionOperation
evaluate
 
Methods inherited from class cascading.operation.BaseOperation
getFieldDeclaration, getNumArgs, printOperationInternal, toString, toStringInternal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface cascading.operation.Operation
getFieldDeclaration, getNumArgs
 

Constructor Detail

ExpressionFunction

public ExpressionFunction(Fields fieldDeclaration,
                          String expression,
                          Class... parameterTypes)
Constructor ExpressionFunction creates a new ExpressionFunction instance.

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

operate

public void operate(TupleEntry input,
                    TupleCollector outputCollector)
Description copied from interface: Function
Method operate provides the implementation of this Function.

Specified by:
operate in interface Function
Parameters:
input - of type TupleEntry
outputCollector - of type TupleEntryListIterator
See Also:
Function.operate(cascading.tuple.TupleEntry,cascading.tuple.TupleCollector)


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