Interface AggregationMultiFunctionHandler
Note the information returned by getReturnType()
must match the
value objects returned by accessors provided by getAccessorMode()
.
For example, assuming you have an EPL statement such as select search(), query() from MyEvent
then you would likely use one handler class and two handler objects (one for search and one for query).
-
Method Summary
Modifier and TypeMethodDescriptionDescribes to the compiler how it should manage code for providing aggregation accessors.Describes to the compiler how it should manage code for providing aggregation agents.Describes to the compiler how it should manage code for providing table column reader.Return a state-key object that determines how the runtimeshares aggregation state between multiple aggregation functions that may appear in the same EPL statement.com.espertech.esper.common.internal.rettype.EPChainableType
Provide return type.Describes to the compiler how it should manage code for providing aggregation state.
-
Method Details
-
getReturnType
com.espertech.esper.common.internal.rettype.EPChainableType getReturnType()Provide return type.The accessor return values must match the return type declared herein.
Use
EPChainableTypeHelper.singleValue(Class)
(Class)} to indicate that the accessor returns a single value. The accessor should return the single value upon invocation ofAggregationMultiFunctionAccessor.getValue(AggregationMultiFunctionState, EventBean[], boolean, ExprEvaluatorContext)
. The accessor should return a null value for all other accessor methods.Use
EPChainableTypeHelper.collectionOfEvents(EventType)
to indicate that the accessor returns a collection of events. The accessor should return a value inAggregationMultiFunctionAccessor.getEnumerableEvents(AggregationMultiFunctionState, EventBean[], boolean, ExprEvaluatorContext)
. The accessor can also return an array of underlying event objects inAggregationMultiFunctionAccessor.getValue(AggregationMultiFunctionState, EventBean[], boolean, ExprEvaluatorContext)
. The accessor should return a null value for all other accessor methods.Use
EPChainableTypeHelper.singleEvent(EventType)
to indicate that the accessor returns a single event. The accessor should return a value inAggregationMultiFunctionAccessor.getEnumerableEvent(AggregationMultiFunctionState, EventBean[], boolean, ExprEvaluatorContext)
. The accessor can also return the underlying event object inAggregationMultiFunctionAccessor.getValue(AggregationMultiFunctionState, EventBean[], boolean, ExprEvaluatorContext)
. The accessor should return a null value for all other accessor methods.Use
EPChainableTypeHelper.collectionOfSingleValue(EPTypeClass)
to indicate that the accessor returns a collection of single values (scalar, object etc.). The accessor should return a java.util.Collection inAggregationMultiFunctionAccessor.getValue(AggregationMultiFunctionState, EventBean[], boolean, ExprEvaluatorContext)
. The accessor should return a null value for all other accessor methods.Use
EPChainableTypeHelper.array(EPTypeClass)
to indicate that the accessor returns an array of single values. The accessor should return an array inAggregationMultiFunctionAccessor.getValue(AggregationMultiFunctionState, EventBean[], boolean, ExprEvaluatorContext)
. The accessor should return a null value for all other accessor methods.- Returns:
- expression result type
-
getAggregationStateUniqueKey
AggregationMultiFunctionStateKey getAggregationStateUniqueKey()Return a state-key object that determines how the runtimeshares aggregation state between multiple aggregation functions that may appear in the same EPL statement.The runtimeapplies equals-semantics to determine state sharing. If two
AggregationMultiFunctionStateKey
instances are equal (implement hashCode and equals) then the runtimeshares a single aggregation state instance for the two aggregation function expressions.If your aggregation function never needs shared state simple return
new AggregationStateKey(){}
.If your aggregation function always shares state simple declare
private static final AggregationStateKey MY_KEY = new AggregationStateKey() {};
andreturn MY_KEY
; (if using multiple handlers declare the key on the factory level).- Returns:
- state key
-
getStateMode
AggregationMultiFunctionStateMode getStateMode()Describes to the compiler how it should manage code for providing aggregation state.- Returns:
- mode object
-
getAccessorMode
AggregationMultiFunctionAccessorMode getAccessorMode()Describes to the compiler how it should manage code for providing aggregation accessors.- Returns:
- mode object
-
getAgentMode
AggregationMultiFunctionAgentMode getAgentMode()Describes to the compiler how it should manage code for providing aggregation agents.- Returns:
- mode object
-
getAggregationMethodMode
AggregationMultiFunctionAggregationMethodMode getAggregationMethodMode(AggregationMultiFunctionAggregationMethodContext ctx) Describes to the compiler how it should manage code for providing table column reader.- Parameters:
ctx
- context- Returns:
- mode object
-