com.espertech.esper.client.util
Class ExpressionReturnType

java.lang.Object
  extended by com.espertech.esper.client.util.ExpressionReturnType

public class ExpressionReturnType
extends java.lang.Object

Carries return type information related to the return values returned by expressions.

Use factory methods to initialize return type information according to the return values that your expression is going to provide.

  1. Use collectionOfEvents(com.espertech.esper.client.EventType) to indicate that the expression returns a collection of events.
  2. Use singleEvent(com.espertech.esper.client.EventType) to indicate that the expression returns a single event.
  3. Use collectionOfSingleValue(Class) to indicate that the expression returns a collection of single values. A single value can be any object including null.
  4. Use array(Class) to indicate that the expression returns an array of single values. A single value can be any object including null.
  5. Use singleValue(Class) to indicate that the expression returns a single value. A single value can be any object including null. Such expression results cannot be used as input to enumeration methods, for example.

.


Method Summary
static ExpressionReturnType array(java.lang.Class arrayComponentType)
          Indicate that the expression return type is an array of a given component type.
static ExpressionReturnType collectionOfEvents(EventType eventTypeOfCollectionEvents)
          Indicate that the expression return type is a collection of a given type of events.
static ExpressionReturnType collectionOfSingleValue(java.lang.Class collectionComponentType)
          Indicate that the expression return type is a collection of a given component type.
static ExpressionReturnType fromMethod(java.lang.reflect.Method method)
          Interrogate the provided method and determine whether it returns single-value, array of single-value or collection of single-value and their component type.
 EventType getCollOfEventEventType()
          Returns the event type of the collection of events returned by the expression, or null if the expression does not return a collection of events.
 java.lang.Class getComponentType()
          Returns the type of the component-type returned by an expression, if there is a component type.
 EventType getSingleEventEventType()
          Returns the event type of the event returned by the expression, or null if the expression does not return a single event.
 java.lang.Class getSingleValueType()
          Returns the type of the single-value returned by an expression.
 boolean isSingleValueNonNull()
          Returns an indicator whether the expression returns a non-null single-value.
static ExpressionReturnType singleEvent(EventType eventTypeOfSingleEvent)
          Indicate that the expression return type is single event of a given event type.
static ExpressionReturnType singleValue(java.lang.Class singleValueType)
          Indicate that the expression return type is a single (non-enumerable) value of the given type.
 java.lang.String toTypeDescriptive()
          Returns a nice text detailing the expression result type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

array

public static ExpressionReturnType array(java.lang.Class arrayComponentType)
Indicate that the expression return type is an array of a given component type.

Parameters:
arrayComponentType - array component type
Returns:
array of single value expression result type

singleValue

public static ExpressionReturnType singleValue(java.lang.Class singleValueType)
Indicate that the expression return type is a single (non-enumerable) value of the given type. The expression can still return an array or collection or events however since the engine would not know the type of such objects and may not use runtime reflection it may not allow certain operations on expression results.

Parameters:
singleValueType - type of single value returned, or null to indicate that the expression always returns null
Returns:
single-value expression result type

collectionOfSingleValue

public static ExpressionReturnType collectionOfSingleValue(java.lang.Class collectionComponentType)
Indicate that the expression return type is a collection of a given component type.

Parameters:
collectionComponentType - collection component type
Returns:
collection of single value expression result type

collectionOfEvents

public static ExpressionReturnType collectionOfEvents(EventType eventTypeOfCollectionEvents)
Indicate that the expression return type is a collection of a given type of events.

Parameters:
eventTypeOfCollectionEvents - the event type of the events that are part of the collection
Returns:
collection of events expression result type

singleEvent

public static ExpressionReturnType singleEvent(EventType eventTypeOfSingleEvent)
Indicate that the expression return type is single event of a given event type.

Parameters:
eventTypeOfSingleEvent - the event type of the event returned
Returns:
single-event expression result type

getSingleValueType

public java.lang.Class getSingleValueType()
Returns the type of the single-value returned by an expression.

For expressions that return a collection of single values, this method returns Collection.class.

For expressions that return an array of single values, this method returns the array type of the component type.

For expressions that return a single event, returns the underlying type of the event type.

For expressions that return a collection of events, return array type of the underlying type of the event type.

Can return null for expressions that always return null.

Returns:
expression's single-value type or null if not applicable

getComponentType

public java.lang.Class getComponentType()
Returns the type of the component-type returned by an expression, if there is a component type.

Returns null for single-event or collection-of-events return type.

Returns null for single-value types that are not declared explicitly as an array or collection.

For array and collection returns the component type of the collection.

Returns:
expression's single-value type or null if not applicable

getSingleEventEventType

public EventType getSingleEventEventType()
Returns the event type of the event returned by the expression, or null if the expression does not return a single event.

Returns:
expression's single-event event type or null if not applicable

getCollOfEventEventType

public EventType getCollOfEventEventType()
Returns the event type of the collection of events returned by the expression, or null if the expression does not return a collection of events.

Returns:
expression's single-event event type or null if not applicable

isSingleValueNonNull

public boolean isSingleValueNonNull()
Returns an indicator whether the expression returns a non-null single-value. If the expression returns a single event or a collection of events the method returns false. If the expression returns a single value or collection of single values or array of single values the method returns true.

Returns:
flag indicating expression returns a single value including array or collection

fromMethod

public static ExpressionReturnType fromMethod(java.lang.reflect.Method method)
Interrogate the provided method and determine whether it returns single-value, array of single-value or collection of single-value and their component type.

Parameters:
method - the class methods
Returns:
expression return type

toTypeDescriptive

public java.lang.String toTypeDescriptive()
Returns a nice text detailing the expression result type.

Returns:
descriptive text

© 2006-2014 EsperTech Inc.
All rights reserved.
Visit us at espertech.com