net.esper.event
Interface EventType

All Known Implementing Classes:
BaseConfigurableEventType, BaseXMLEventType, BeanEventType, CompositeEventType, SchemaXMLEventType, SimpleXMLEventType

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 event type behaves somewhat similar to the DynaClass and DynaBean interfaces in the Jakarta commons beanutils package. The Jakarta beanutils were not used for the reason that they don't provide a Getter interface for fast retrieval of event property values for a given property name and given Java object or Map. Also, events are immutable which contradicts the DynaBean interface.

Information on the super-types (superclass and interfaces implemented by JavaBean events) is also available. Supertypes generally exclude Java language interfaces and types.


Method Summary
 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.
 EventPropertyGetter getGetter(String property)
          Get the getter for a specified event property.
 String[] getPropertyNames()
          Get all valid property names for the event type.
 Class getPropertyType(String property)
          Get the type of an event property as returned by the "getter" method for that property.
 EventType[] getSuperTypes()
          Returns an array of event types that are super to this event type, from which this event type inherited event properties.
 Class getUnderlyingType()
          Get the class that represents the Java type of the event type.
 boolean isProperty(String property)
          Check that the given property name is valid for this event type, ie.
 

Method Detail

getPropertyType

Class getPropertyType(String property)
Get the type of an event property as returned by the "getter" method for that property. Returns unboxed (such as 'int.class') as well as boxed (java.lang.Integer) type. Returns null if the property name is not valid.

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

getUnderlyingType

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

getGetter

EventPropertyGetter getGetter(String property)
Get the getter for a specified event property. Returns null if the property name is not valid.

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

getPropertyNames

String[] getPropertyNames()
Get all valid property names for the event type.

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

isProperty

boolean isProperty(String property)
Check that the given property name is valid for this event type, ie. that is exists in the event type.

Parameters:
property - is the property to check
Returns:
true if exists, false if not

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

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