com.espertech.esper.client
Interface EventType

All Known Subinterfaces:
EventTypeSPI
All Known Implementing Classes:
BaseConfigurableEventType, BaseNestableEventType, BaseXMLEventType, BeanEventType, MapEventType, ObjectArrayEventType, RevisionEventType, SchemaXMLEventType, SimpleXMLEventType, VariantEventType, WrapperEventType

public interface EventType

This interface provides metadata on events.

The interface exposes events as organizations of named values. The contract is that any event in the system must have a name-based way of accessing sub-data within its event type. A simple example is a Java bean: the names can be property names, and those properties can have still more properties beneath them. Another example is a Map structure. Here string names can refer to data objects.

The interface presents an immutable view of events. There are no methods to change property values. Events by definition are an observation of a past occurrance or state change and may not be modified.

Information on the super-types (superclass and interfaces implemented by JavaBean events) is also available, for Java POJO events as well as for Map event types that has supertypes.

Implementations provide metadata on the properties that an implemenation itself provides.

Implementations also allow property expressioms that may use nested, indexed, mapped or a combination of these as a syntax to access property types and values.

Implementations in addition may provide a means to access property values as event fragments, which are typed events themselves.


Method Summary
 java.util.Iterator<EventType> getDeepSuperTypes()
          Returns iterator over all super types to event type, going up the hierarchy and including all Java interfaces (and their extended interfaces) and superclasses as EventType instances.
 java.lang.String getEndTimestampPropertyName()
          Returns the property name of the property providing the end timestamp value.
 int getEventTypeId()
          Returns the event type id assigned to the event type.
 FragmentEventType getFragmentType(java.lang.String propertyExpression)
          Returns the event type of the fragment that is the value of a property name or property expression.
 EventPropertyGetter getGetter(java.lang.String propertyExpression)
          Get the getter of an event property or property expression: Getters are useful when an application receives events of the same event type multiple times and requires fast access to an event property or nested, indexed or mapped property.
 EventPropertyGetterIndexed getGetterIndexed(java.lang.String indexedPropertyName)
          Get the getter of an event property that is a indexed event property: Getters are useful when an application receives events of the same event type multiple times and requires fast access to a indexed property.
 EventPropertyGetterMapped getGetterMapped(java.lang.String mappedPropertyName)
          Get the getter of an event property that is a mapped event property: Getters are useful when an application receives events of the same event type multiple times and requires fast access to a mapped property.
 java.lang.String getName()
          Returns the type name or null if no type name is assigned.
 EventPropertyDescriptor getPropertyDescriptor(java.lang.String propertyName)
          Get the property descriptor for a given property of the event, or null if a property by that name was not found.
 EventPropertyDescriptor[] getPropertyDescriptors()
          Get property descriptors for the event type.
 java.lang.String[] getPropertyNames()
          Get the property names for the event type.
 java.lang.Class getPropertyType(java.lang.String propertyExpression)
          Get the type of an event property.
 java.lang.String getStartTimestampPropertyName()
          Returns the property name of the property providing the start timestamp value.
 EventType[] getSuperTypes()
          Returns an array of event types that are super to this event type, from which this event type inherited event properties.
 java.lang.Class getUnderlyingType()
          Get the class that represents the Java type of the event type.
 boolean isProperty(java.lang.String propertyExpression)
          Check that the given property name or property expression is valid for this event type, ie.
 

Method Detail

getPropertyType

java.lang.Class getPropertyType(java.lang.String propertyExpression)
Get the type of an event property.

Returns null if the property name or property expression is not valid against the event type. Can also return null if a select-clause selects a constant null value.

The method takes a property name or property expression as a parameter. Property expressions may include indexed properties via the syntax "name[index]", mapped properties via the syntax "name('key')", nested properties via the syntax "outer.inner" or combinations thereof.

Returns unboxed (such as 'int.class') as well as boxed (java.lang.Integer) type.

Parameters:
propertyExpression - is the property name or property expression
Returns:
type of the property, the unboxed or the boxed type.

isProperty

boolean isProperty(java.lang.String propertyExpression)
Check that the given property name or property expression is valid for this event type, ie. that the property exists on the event type.

The method takes a property name or property expression as a parameter. Property expressions may include indexed properties via the syntax "name[index]", mapped properties via the syntax "name('key')", nested properties via the syntax "outer.inner" or combinations thereof.

Parameters:
propertyExpression - is the property name or property expression to check
Returns:
true if exists, false if not

getGetter

EventPropertyGetter getGetter(java.lang.String propertyExpression)
Get the getter of an event property or property expression: Getters are useful when an application receives events of the same event type multiple times and requires fast access to an event property or nested, indexed or mapped property.

Returns null if the property name or property expression is not valid against the event type.

The method takes a property name or property expression as a parameter. Property expressions may include indexed properties via the syntax "name[index]", mapped properties via the syntax "name('key')", nested properties via the syntax "outer.inner" or combinations thereof.

Parameters:
propertyExpression - is the property name or property expression
Returns:
a getter that can be used to obtain property values for event instances of the same event type

getFragmentType

FragmentEventType getFragmentType(java.lang.String propertyExpression)
Returns the event type of the fragment that is the value of a property name or property expression.

Returns null if the property name or property expression is not valid or does not return a fragment for the event type.

The EventPropertyDescriptor provides a flag that indicates which properties provide fragment events.

This is useful for navigating properties that are itself events or other well-defined types that the underlying event representation may represent as an event type. It is up to each event representation to determine what properties can be represented as event types themselves.

The method takes a property name or property expression as a parameter. Property expressions may include indexed properties via the syntax "name[index]", mapped properties via the syntax "name('key')", nested properties via the syntax "outer.inner" or combinations thereof.

The underlying event representation may not support providing fragments or therefore fragment event types for any or all properties, in which case the method returns null.

Use the getPropertyDescriptors() method to obtain a list of properties for which a fragment event type may be retrieved by this method.

Parameters:
propertyExpression - is the name of the property to return the fragment event type
Returns:
fragment event type of the property

getUnderlyingType

java.lang.Class getUnderlyingType()
Get the class that represents the Java type of the event type. Returns a Java bean event class if the schema represents a Java bean event type. Returns java.util.Map is the schema represents a collection of values in a Map.

Returns:
type of the event object

getPropertyNames

java.lang.String[] getPropertyNames()
Get the property names for the event type.

Note that properties do not have a defined order. Your application should not rely on the order of properties returned by this method.

The method does not return property names of inner or nested types.

Returns:
A string array containing the property names of this typed event data object.

getPropertyDescriptors

EventPropertyDescriptor[] getPropertyDescriptors()
Get property descriptors for the event type.

Note that properties do not have a defined order. Your application should not rely on the order of properties returned by this method.

The method does not return property information of inner or nested types.

Returns:
descriptors for all known properties of the event type.

getPropertyDescriptor

EventPropertyDescriptor getPropertyDescriptor(java.lang.String propertyName)
Get the property descriptor for a given property of the event, or null if a property by that name was not found.

The property name parameter does accept a property expression. It therefore does not allow the indexed, mapped or nested property expression syntax and only returns the descriptor for the event type's known properties.

The method does not return property information of inner or nested types.

For returning a property descriptor for nested, indexed or mapped properties use EventTypeUtility.

Parameters:
propertyName - property name
Returns:
descriptor for the named property

getSuperTypes

EventType[] getSuperTypes()
Returns an array of event types that are super to this event type, from which this event type inherited event properties.

For Java bean instances underlying the event this method returns the event types for all superclasses extended by the Java bean and all interfaces implemented by the Java bean.

Returns:
an array of event types

getDeepSuperTypes

java.util.Iterator<EventType> getDeepSuperTypes()
Returns iterator over all super types to event type, going up the hierarchy and including all Java interfaces (and their extended interfaces) and superclasses as EventType instances.

Returns:
iterator of event types represeting all superclasses and implemented interfaces, all the way up to java.lang.Object but excluding java.lang.Object itself

getName

java.lang.String getName()
Returns the type name or null if no type name is assigned.

A type name is available for application-configured event types and for event types that represent events of a stream populated by insert-into.

No type name is available for anonymous statement-specific event type.

Returns:
type name or null if none assigned

getGetterMapped

EventPropertyGetterMapped getGetterMapped(java.lang.String mappedPropertyName)
Get the getter of an event property that is a mapped event property: Getters are useful when an application receives events of the same event type multiple times and requires fast access to a mapped property.

Returns null if the property name is not valid against the event type or the property is not a mapped property.

The method takes a mapped property name (and not a property expression) as a parameter.

Parameters:
mappedPropertyName - is the property name
Returns:
a getter that can be used to obtain property values for event instances of the same event type

getGetterIndexed

EventPropertyGetterIndexed getGetterIndexed(java.lang.String indexedPropertyName)
Get the getter of an event property that is a indexed event property: Getters are useful when an application receives events of the same event type multiple times and requires fast access to a indexed property.

Returns null if the property name is not valid against the event type or the property is not an indexed property.

The method takes a indexed property name (and not a property expression) as a parameter.

Parameters:
indexedPropertyName - is the property name
Returns:
a getter that can be used to obtain property values for event instances of the same event type

getEventTypeId

int getEventTypeId()
Returns the event type id assigned to the event type.

Returns:
event type id

getStartTimestampPropertyName

java.lang.String getStartTimestampPropertyName()
Returns the property name of the property providing the start timestamp value.

Returns:
start timestamp property name

getEndTimestampPropertyName

java.lang.String getEndTimestampPropertyName()
Returns the property name of the property providing the end timestamp value.

Returns:
end timestamp property name

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