- 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:
ReflectiveFactory
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MappedEvaluatorFactory.Mapping
Defines a mapping between data type and an evaluator class.
-
Constructor Summary
Constructors Modifier Constructor Description protected
MappedEvaluatorFactory()
Creates a factory with no mapping.protected
MappedEvaluatorFactory(MappedEvaluatorFactory.Mapping... mappings)
Creates a factory using the supplied mappings.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description FunctionEvaluator
contructEvaluator(ScalarSettable result, Object[] arguments)
Construct a new evaluator for the associated function with the given arguments, bound to the specified output buffer.protected abstract ScalarTokenType
getDispatchType(ScalarSettable result, Object[] arguments)
Determines the type to use to select the evaluator.static MappedEvaluatorFactory.Mapping
use(ScalarTokenType type, Class<? extends FunctionEvaluator> evaluator)
Defines the evaluator class for a given type.
-
-
-
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
-
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
protected abstract ScalarTokenType getDispatchType(ScalarSettable result, Object[] arguments)
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
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 interfaceEvaluatorFactory
- Parameters:
result
- the buffer to which the function result is writtenarguments
- the arguments to the function- Returns:
- a new evaluator for the function
-
-