## cascading.operation.expression
Class ExpressionFunction

    java.lang.Object
      cascading.operation.BaseOperation<ExpressionOperation.Context>
          cascading.operation.expression.ExpressionOperation
              cascading.operation.expression.ExpressionFunction

All Implemented Interfaces:
  Function<ExpressionOperation.Context>, Operation<ExpressionOperation.Context>, Serializable

    public class ExpressionFunction

extends ExpressionOperation
implements Function<ExpressionOperation.Context>

Class ExpressionFunction dynamically resolves a given expression using argument `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`

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
`ExpressionOperation.Context`

Field Summary

Fields inherited from class cascading.operation.expression.ExpressionOperation
`expression`

Fields inherited from class cascading.operation.BaseOperation
`fieldDeclaration, numArgs, trace`

Fields inherited from interface cascading.operation.Operation
`ANY`

Constructor Summary
`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.

Method Summary
`void` `operate(FlowProcess flowProcess, FunctionCall<ExpressionOperation.Context> functionCall)` Method operate provides the implementation of this Function.

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

### ExpressionFunction

    @ConstructorProperties(value={"fieldDeclaration","expression"})
    public ExpressionFunction(Fields fieldDeclaration,
                                                         String expression)

  Constructor ExpressionFunction creates a new ExpressionFunction instance.

  This constructor assumes the given expression expects no input parameters. This is useful when inserting random numbers for example, `(int) (Math.random() * Integer.MAX_VALUE)` .

  Parameters:
    `fieldDeclaration` - of type Fields
    `expression` - of type String

### ExpressionFunction

    @ConstructorProperties(value={"fieldDeclaration","expression","parameterType"})
    public ExpressionFunction(Fields fieldDeclaration,
                                                         String expression,
                                                         Class parameterType)

  Constructor ExpressionFunction creates a new ExpressionFunction instance.

  This constructor assumes all parameter are of the same type.

  Parameters:
    `fieldDeclaration` - of type Fields
    `expression` - of type String
    `parameterType` - of type Class

### ExpressionFunction

    @ConstructorProperties(value={"fieldDeclaration","expression","parameterNames","parameterTypes"})
    public ExpressionFunction(Fields fieldDeclaration,
                                                         String expression,
                                                         String[] parameterNames,
                                                         Class[] parameterTypes)

  Constructor ExpressionFunction creates a new ExpressionFunction instance.

  This constructor expects all parameter type names to be declared with their types. Positional parameters must be named the same as in the given expression with the "$" sign prepended.

  Parameters:
    `fieldDeclaration` - of type Fields
    `expression` - of type String
    `parameterNames` - of type String[]
    `parameterTypes` - of type Class[]

Method Detail

### operate

    public void operate(FlowProcess flowProcess,
                        FunctionCall<ExpressionOperation.Context> functionCall)

  Description copied from interface: `Function`
  Method operate provides the implementation of this Function.

  Specified by:
    `operate` in interface `Function<ExpressionOperation.Context>`
  Parameters:
    `flowProcess` - of type FlowProcess
    `functionCall` - of type FunctionCall
  See Also:
    `Function.operate(cascading.flow.FlowProcess,cascading.operation.FunctionCall)`

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