Class 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:
    ReflectiveFactory
    • Constructor Detail

      • 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 Detail

      • 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