com.espertech.esper.event
Class WrapperEventType

java.lang.Object
  extended by com.espertech.esper.event.WrapperEventType
All Implemented Interfaces:
EventType

public class WrapperEventType
extends Object
implements EventType

An event type that adds zero or more fields to an existing event type.

The additional fields are represented as a Map. Any queries to event properties are first held against the additional fields, and secondly are handed through to the underlying event.

If this event type is to add information to another wrapper event type (wrapper to wrapper), then it is the responsibility of the creating logic to use the existing event type and add to it.

Uses a the map event type MapEventType to represent the mapped properties. This is because the additional properties can also be beans or complex types and the Map event type handles these nicely.


Field Summary
protected  EventType underlyingEventType
          The underlying wrapped event type.
protected  MapEventType underlyingMapType
          The map event type that provides the additional properties.
 
Constructor Summary
WrapperEventType(String typeName, EventType eventType, Map<String,Object> properties, EventAdapterService eventAdapterService)
          Ctor.
 
Method Summary
 boolean equals(Object obj)
           
 String getAlias()
          Returns the event type alias.
 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.
 EventType getUnderlyingEventType()
          Returns the wrapped event type.
 MapEventType getUnderlyingMapType()
          Returns the map type.
 Class getUnderlyingType()
          Get the class that represents the Java type of the event type.
 int hashCode()
           
 boolean isProperty(String property)
          Check that the given property name is valid for this event type, ie.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

underlyingEventType

protected final EventType underlyingEventType
The underlying wrapped event type.


underlyingMapType

protected final MapEventType underlyingMapType
The map event type that provides the additional properties.

Constructor Detail

WrapperEventType

public WrapperEventType(String typeName,
                        EventType eventType,
                        Map<String,Object> properties,
                        EventAdapterService eventAdapterService)
Ctor.

Parameters:
typeName - is the event type alias name
eventType - is the event type of the wrapped events
properties - is the additional properties this wrapper adds
eventAdapterService - is the ser
Method Detail

getDeepSuperTypes

public Iterator<EventType> getDeepSuperTypes()
Description copied from interface: EventType
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.

Specified by:
getDeepSuperTypes in interface EventType
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

getAlias

public String getAlias()
Returns the event type alias.

Returns:
event type alias

getGetter

public EventPropertyGetter getGetter(String property)
Description copied from interface: EventType
Get the getter for a specified event property. Returns null if the property name is not valid.

Specified by:
getGetter in interface EventType
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

public String[] getPropertyNames()
Description copied from interface: EventType
Get all valid property names for the event type.

Specified by:
getPropertyNames in interface EventType
Returns:
A string array containing the property names of this typed event data object.

getPropertyType

public Class getPropertyType(String property)
Description copied from interface: EventType
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.

Specified by:
getPropertyType in interface EventType
Parameters:
property - is the property name
Returns:
type of the property, the unboxed or the boxed type.

getSuperTypes

public EventType[] getSuperTypes()
Description copied from interface: EventType
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.

Specified by:
getSuperTypes in interface EventType
Returns:
an array of event types

getUnderlyingType

public Class getUnderlyingType()
Description copied from interface: EventType
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.

Specified by:
getUnderlyingType in interface EventType
Returns:
type of the event object

getUnderlyingEventType

public EventType getUnderlyingEventType()
Returns the wrapped event type.

Returns:
wrapped type

getUnderlyingMapType

public MapEventType getUnderlyingMapType()
Returns the map type.

Returns:
map type providing additional properties.

isProperty

public boolean isProperty(String property)
Description copied from interface: EventType
Check that the given property name is valid for this event type, ie. that is exists in the event type.

Specified by:
isProperty in interface EventType
Parameters:
property - is the property to check
Returns:
true if exists, false if not

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

© 2007 EsperTech Inc.
All rights reserved.
Visit us at espertech.com