java.lang.Object
com.pervasive.datarush.functions.MappedEvaluatorFactory
- All Implemented Interfaces:
EvaluatorFactory
- Direct Known Subclasses:
InputMappedFactory,ResultMappedFactory
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDefines a mapping between data type and an evaluator class. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreates a factory with no mapping.protectedMappedEvaluatorFactory(MappedEvaluatorFactory.Mapping... mappings) Creates a factory using the supplied mappings. -
Method Summary
Modifier and TypeMethodDescriptioncontructEvaluator(ScalarSettable result, Object[] arguments) Construct a new evaluator for the associated function with the given arguments, bound to the specified output buffer.protected abstract ScalarTokenTypegetDispatchType(ScalarSettable result, Object[] arguments) Determines the type to use to select the evaluator.use(ScalarTokenType type, Class<? extends FunctionEvaluator> evaluator) Defines the evaluator class for a given type.
-
Constructor Details
-
MappedEvaluatorFactory
protected MappedEvaluatorFactory()Creates a factory with no mapping. This constructor is provided only for serialization support. -
MappedEvaluatorFactory
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 mappingevaluator- the class of the evaluator to create- Returns:
- a mapping
-
getDispatchType
Determines the type to use to select the evaluator.- Parameters:
result- the result buffer for the functionarguments- the arguments to the function- Returns:
- the type to use to lookup the evaluator
-
contructEvaluator
Description copied from interface:EvaluatorFactoryConstruct a new evaluator for the associated function with the given arguments, bound to the specified output buffer.- Specified by:
contructEvaluatorin interfaceEvaluatorFactory- Parameters:
result- the buffer to which the function result is writtenarguments- the arguments to the function- Returns:
- a new evaluator for the function
-