cascading.operation.expression

## Class ExpressionFilter

- java.lang.Object
- - cascading.operation.BaseOperation<ScriptOperation.Context>
  - - cascading.operation.expression.ScriptOperation
    - - cascading.operation.expression.ExpressionOperation
      - - cascading.operation.expression.ExpressionFilter

- All Implemented Interfaces:
    DeclaresResults, Filter<ScriptOperation.Context>, Operation<ScriptOperation.Context>, Traceable, java.io.Serializable

      public class ExpressionFilter
      extends ExpressionOperation
      implements Filter<ScriptOperation.Context>

  Class ExpressionFilter dynamically resolves a given expression using argument `Tuple` values. Any Tuple that returns true for the given expression will be removed from the stream. This `Filter` 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.

  Field names used in the expression should be valid Java variable names; for example, '+' or '-' are not allowed. Also the use of a field name that begins with an upper-case character is likely to fail and should be avoided.
  See Also:
    Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class cascading.operation.expression.ScriptOperation

      `ScriptOperation.Context`

  - ### Field Summary

    - ### Fields inherited from class cascading.operation.expression.ScriptOperation

      `block, parameterNames, parameterTypes, returnType`

    - ### Fields inherited from class cascading.operation.BaseOperation

      `fieldDeclaration, numArgs, trace`

    - ### Fields inherited from interface cascading.operation.Operation

      `ANY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ExpressionFilter(java.lang.String expression)` Constructor ExpressionFilter creates a new ExpressionFilter instance.
    `ExpressionFilter(java.lang.String expression, java.lang.Class parameterType)` Constructor ExpressionFilter creates a new ExpressionFilter instance.
    `ExpressionFilter(java.lang.String expression, java.lang.String[] parameterNames, java.lang.Class[] parameterTypes)` Constructor ExpressionFilter creates a new ExpressionFilter instance.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `isRemove(FlowProcess flowProcess, FilterCall<ScriptOperation.Context> filterCall)`

    - ### Methods inherited from class cascading.operation.expression.ExpressionOperation

      `getEvaluator, getExpression, guessParameterNames`

    - ### Methods inherited from class cascading.operation.expression.ScriptOperation

      `equals, evaluate, getBlock, getParameterNames, getParameterTypes, getReturnType, hashCode, prepare`

    - ### Methods inherited from class cascading.operation.BaseOperation

      `cleanup, flush, 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, flush, getFieldDeclaration, getNumArgs, isSafe, prepare`

- - ### Constructor Detail

    - #### ExpressionFilter

          @ConstructorProperties(value="expression")
          public ExpressionFilter(java.lang.String expression)

      Constructor ExpressionFilter creates a new ExpressionFilter instance.

      This constructor, when used with incoming arguments that have type information, the argument field names can be used directly in the the expression, for example `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, for example `Math.random() < SomeClass.someValue()` .
      Parameters:
        `expression` - of type String

    - #### ExpressionFilter

          @ConstructorProperties(value={"expression","parameterType"})
          public ExpressionFilter(java.lang.String expression,
                                                java.lang.Class parameterType)

      Constructor ExpressionFilter creates a new ExpressionFilter instance.
      Parameters:
        `expression` - of type String
        `parameterType` - of type Class

    - #### ExpressionFilter

          @ConstructorProperties(value={"expression","parameterNames","parameterTypes"})
          public ExpressionFilter(java.lang.String expression,
                                                java.lang.String[] parameterNames,
                                                java.lang.Class[] parameterTypes)

      Constructor ExpressionFilter creates a new ExpressionFilter instance.
      Parameters:
        `expression` - of type String
        `parameterNames` - of type String[]
        `parameterTypes` - of type Class[]

  - ### Method Detail

    - #### isRemove

          public boolean isRemove(FlowProcess flowProcess,
                         FilterCall<ScriptOperation.Context> filterCall)

      Specified by:
        `isRemove` in interface `Filter<ScriptOperation.Context>`

Copyright © 2007-2015 Xplenty, Inc. All Rights Reserved.