net.esper.event
Class MapEventType

java.lang.Object
  extended by net.esper.event.MapEventType
All Implemented Interfaces:
EventType

public class MapEventType
extends Object
implements EventType

Implementation of the EventType interface for handling plain Maps containing name value pairs.


Constructor Summary
MapEventType(String typeName, Map<String,Class> propertyTypes, EventAdapterService eventAdapterService)
          Constructor takes a type name, map of property names and types.
 
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 propertyName)
          Get the getter for a specified event property.
 String[] getPropertyNames()
          Get all valid property names for the event type.
 Class getPropertyType(String propertyName)
          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.
 Map<String,Class> getTypes()
          Returns the name-type map of map properties.
 Class getUnderlyingType()
          Get the class that represents the Java type of the event type.
 Object getValue(String propertyName, Map values)
          Returns the value of the given property, allowing nested property names.
 int hashCode()
           
 boolean isProperty(String propertyName)
          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
 

Constructor Detail

MapEventType

public MapEventType(String typeName,
                    Map<String,Class> propertyTypes,
                    EventAdapterService eventAdapterService)
Constructor takes a type name, map of property names and types.

Parameters:
typeName - is the event type name used to distinquish map types that have the same property types, empty string for anonymous maps, or for insert-into statements generating map events the stream name
propertyTypes - is pairs of property name and type
eventAdapterService - is required for access to objects properties within map values
Method Detail

getPropertyType

public final Class getPropertyType(String propertyName)
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:
propertyName - is the property name
Returns:
type of the property, the unboxed or the boxed type.

getUnderlyingType

public final 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

getGetter

public EventPropertyGetter getGetter(String propertyName)
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:
propertyName - is the property name
Returns:
a getter that can be used to obtain property values for event instances of the same event type

getValue

public Object getValue(String propertyName,
                       Map values)
Returns the value of the given property, allowing nested property names.

Parameters:
propertyName - is the name of the property
values - is the map to get the value from
Returns:
property value

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.

isProperty

public boolean isProperty(String propertyName)
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:
propertyName - is the property to check
Returns:
true if exists, false if not

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

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

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

getAlias

public String getAlias()
Returns the event type alias.

Returns:
event type alias

getTypes

public Map<String,Class> getTypes()
Returns the name-type map of map properties.

Returns:
is the property name and types