|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.esper.event.EventTypeFactory
public final class EventTypeFactory
A singleton factory class for obtaining EventType
instances. The singleton caches EventType
instances
for Java beans, and does not cache event types for Map-based events.
It is recommended to cache references to Map type implementations and reuse them for memory efficiency.
Usage (JavaBean):
Class employeeBeanClass = Class.forName("com.xyz.beans.Employee"); EventType empolyeeType = EventTypeFactory.getInstance().createBeanType(employeeBeanClass);Usage (Map):
HashMap employeeProperties = new HashMap(); employeeProperties.put("firstName", String.class); employeeProperties.put("SSN", Integer.class); EventType empolyeeType = EventTypeFactory.getInstance().createMapType(employeeProperties);
Method Summary | |
---|---|
protected void |
clear()
Clear any cached types - for unit testing pruposes. |
EventType |
createBeanType(java.lang.Class clazz)
Creates a new EventType object for a java bean of the specified class if this is the first time the class has been seen. |
EventType |
createMapType(java.util.Map<java.lang.String,java.lang.Class> propertyTypes)
Creates a new EventType instance for an event type that contains a map of name value pairs. |
java.util.Set<EventType> |
getDeepSuperTypes(EventType eventType)
Returns super types to event type, going up the hierarchy and including all super-interfaces and classes. |
static EventTypeFactory |
getInstance()
Returns singleton instance. |
protected static void |
getSuper(java.lang.Class clazz,
java.util.Set<java.lang.Class> result)
Add the given class's implemented interfaces and superclasses to the result set of classes. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static EventTypeFactory getInstance()
protected void clear()
public final EventType createMapType(java.util.Map<java.lang.String,java.lang.Class> propertyTypes)
New instances are created by this method on every invocation. Clients to this method need to cache the returned EventType instance to reuse EventType's for same-typed events.
propertyTypes
- is a map of String to Class objects
public final EventType createBeanType(java.lang.Class clazz)
clazz
- is the class of the Java bean.
public final java.util.Set<EventType> getDeepSuperTypes(EventType eventType)
eventType
- is the type to traverse up
protected static void getSuper(java.lang.Class clazz, java.util.Set<java.lang.Class> result)
clazz
- to introspectresult
- to add classes to
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |