Class MappedEvaluatorFactory

java.lang.Object
com.pervasive.datarush.functions.MappedEvaluatorFactory
All Implemented Interfaces:
EvaluatorFactory
Direct Known Subclasses:
InputMappedFactory, ResultMappedFactory

public abstract class MappedEvaluatorFactory extends Object implements EvaluatorFactory
A base class for factories which choose an evaluator based on a token type. The mapping is static, defined at construction, and uses reflection to create the evaluator. Lookup is by exact match; type assignability is not taken into account.
See Also:
  • Constructor Details

    • MappedEvaluatorFactory

      protected MappedEvaluatorFactory()
      Creates a factory with no mapping. This constructor is provided only for serialization support.
    • MappedEvaluatorFactory

      protected MappedEvaluatorFactory(MappedEvaluatorFactory.Mapping... mappings)
      Creates a factory using the supplied mappings.
      Parameters:
      mappings - the type to evaluator mappings to use
  • Method Details

    • use

      public static MappedEvaluatorFactory.Mapping use(ScalarTokenType type, Class<? extends FunctionEvaluator> evaluator)
      Defines the evaluator class for a given type.
      Parameters:
      type - the token type for which to define a mapping
      evaluator - the class of the evaluator to create
      Returns:
      a mapping
    • getDispatchType

      protected abstract ScalarTokenType getDispatchType(ScalarSettable result, Object[] arguments)
      Determines the type to use to select the evaluator.
      Parameters:
      result - the result buffer for the function
      arguments - the arguments to the function
      Returns:
      the type to use to lookup the evaluator
    • contructEvaluator

      public FunctionEvaluator contructEvaluator(ScalarSettable result, Object[] arguments)
      Description copied from interface: EvaluatorFactory
      Construct a new evaluator for the associated function with the given arguments, bound to the specified output buffer.
      Specified by:
      contructEvaluator in interface EvaluatorFactory
      Parameters:
      result - the buffer to which the function result is written
      arguments - the arguments to the function
      Returns:
      a new evaluator for the function