public abstract class BaseNestableEventType extends Object implements EventTypeSPI
EventType
interface for handling name value pairs.Modifier and Type | Field and Description |
---|---|
protected String |
endTimestampPropertyName |
protected EventAdapterService |
eventAdapterService |
protected int |
eventTypeId |
protected EventTypeNestableGetterFactory |
getterFactory |
protected EventTypeMetadata |
metadata |
protected Map<String,Object> |
nestableTypes |
protected Set<EventType> |
optionalDeepSupertypes |
protected EventType[] |
optionalSuperTypes |
protected EventPropertyDescriptor[] |
propertyDescriptors |
protected Map<String,EventPropertyGetterSPI> |
propertyGetterCache |
protected Map<String,PropertySetDescriptorItem> |
propertyItems |
protected String[] |
propertyNames |
protected String |
startTimestampPropertyName |
protected String |
typeName |
Constructor and Description |
---|
BaseNestableEventType(EventTypeMetadata metadata,
String typeName,
int eventTypeId,
EventAdapterService eventAdapterService,
Map<String,Object> propertyTypes,
EventType[] optionalSuperTypes,
Set<EventType> optionalDeepSupertypes,
ConfigurationEventTypeWithSupertype typeConfig,
EventTypeNestableGetterFactory getterFactory)
Constructor takes a type name, map of property names and types, for
use with nestable Map events.
|
Modifier and Type | Method and Description |
---|---|
void |
addAdditionalProperties(Map<String,Object> typeMap,
EventAdapterService eventAdapterService)
Adds additional properties that do not yet exist on the given type.
|
boolean |
equalsCompareType(EventType otherEventType) |
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.
|
String |
getEndTimestampPropertyName()
Returns the property name of the property providing the end timestamp value.
|
String |
getEqualsMessage(EventType otherType)
Returns a message if the type, compared to this type, is not compatible in regards to the property numbers
and types.
|
int |
getEventTypeId()
Returns the event type id assigned to the event type.
|
FragmentEventType |
getFragmentType(String propertyName)
Returns the event type of the fragment that is the value of a property name or property expression.
|
EventPropertyGetter |
getGetter(String propertyName)
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(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.
|
EventPropertyGetterIndexedSPI |
getGetterIndexedSPI(String indexedPropertyName) |
EventPropertyGetterMapped |
getGetterMapped(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.
|
EventPropertyGetterMappedSPI |
getGetterMappedSPI(String mappedPropertyName) |
EventPropertyGetterSPI |
getGetterSPI(String propertyName) |
EventTypeMetadata |
getMetadata()
Returns the type metadata.
|
String |
getName()
Returns the type name or null if no type name is assigned.
|
EventPropertyDescriptor |
getPropertyDescriptor(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.
|
String[] |
getPropertyNames()
Get the property names for the event type.
|
Class |
getPropertyType(String propertyName)
Get the type of an event property.
|
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.
|
Map<String,Object> |
getTypes()
Returns the name-type map of map properties, each value in the map
can be a Class or a Map<String, Object> (for nested maps).
|
static String |
isDeepEqualsProperties(String otherName,
Map<String,Object> setOne,
Map<String,Object> setTwo)
Compares two sets of properties and determines if they are the same, allowing for
boxed/unboxed types, and nested map types.
|
boolean |
isProperty(String propertyName)
Check that the given property name or property expression is valid for this event type, ie.
|
protected abstract void |
postUpdateNestableTypes() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getCopyMethod, getReader, getWritableProperty, getWriteableProperties, getWriter, getWriter
getUnderlyingType
protected final EventTypeMetadata metadata
protected final String typeName
protected final EventAdapterService eventAdapterService
protected final EventType[] optionalSuperTypes
protected final int eventTypeId
protected final EventTypeNestableGetterFactory getterFactory
protected String[] propertyNames
protected EventPropertyDescriptor[] propertyDescriptors
protected final Map<String,PropertySetDescriptorItem> propertyItems
protected Map<String,EventPropertyGetterSPI> propertyGetterCache
protected String startTimestampPropertyName
protected String endTimestampPropertyName
public BaseNestableEventType(EventTypeMetadata metadata, String typeName, int eventTypeId, EventAdapterService eventAdapterService, Map<String,Object> propertyTypes, EventType[] optionalSuperTypes, Set<EventType> optionalDeepSupertypes, ConfigurationEventTypeWithSupertype typeConfig, EventTypeNestableGetterFactory getterFactory)
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 namepropertyTypes
- is pairs of property name and typeeventAdapterService
- is required for access to objects properties within map valuesoptionalSuperTypes
- the supertypes to this type if any, or null if there are no supertypesoptionalDeepSupertypes
- the deep supertypes to this type if any, or null if there are no deep supertypesmetadata
- event type metadatatypeConfig
- type configeventTypeId
- tye idgetterFactory
- getter factoryprotected abstract void postUpdateNestableTypes()
public String getName()
EventType
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.
public int getEventTypeId()
EventType
getEventTypeId
in interface EventType
public String getStartTimestampPropertyName()
EventType
getStartTimestampPropertyName
in interface EventType
public String getEndTimestampPropertyName()
EventType
getEndTimestampPropertyName
in interface EventType
public final Class getPropertyType(String propertyName)
EventType
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.
getPropertyType
in interface EventType
propertyName
- is the property name or property expressionpublic EventPropertyGetterSPI getGetterSPI(String propertyName)
getGetterSPI
in interface EventTypeSPI
public EventPropertyGetter getGetter(String propertyName)
EventType
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.
public EventPropertyGetterMapped getGetterMapped(String mappedPropertyName)
EventType
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.
getGetterMapped
in interface EventType
mappedPropertyName
- is the property namepublic EventPropertyGetterMappedSPI getGetterMappedSPI(String mappedPropertyName)
getGetterMappedSPI
in interface EventTypeSPI
public EventPropertyGetterIndexed getGetterIndexed(String indexedPropertyName)
EventType
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.
getGetterIndexed
in interface EventType
indexedPropertyName
- is the property namepublic EventPropertyGetterIndexedSPI getGetterIndexedSPI(String indexedPropertyName)
getGetterIndexedSPI
in interface EventTypeSPI
public String[] getPropertyNames()
EventType
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.
getPropertyNames
in interface EventType
public boolean isProperty(String propertyName)
EventType
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.
isProperty
in interface EventType
propertyName
- is the property name or property expression to checkpublic EventType[] getSuperTypes()
EventType
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.
getSuperTypes
in interface EventType
public Iterator<EventType> getDeepSuperTypes()
EventType
getDeepSuperTypes
in interface EventType
public Map<String,Object> getTypes()
public void addAdditionalProperties(Map<String,Object> typeMap, EventAdapterService eventAdapterService)
typeMap
- properties to addeventAdapterService
- for resolving further map event types that are property typespublic EventPropertyDescriptor[] getPropertyDescriptors()
EventType
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.
getPropertyDescriptors
in interface EventType
public static String isDeepEqualsProperties(String otherName, Map<String,Object> setOne, Map<String,Object> setTwo)
setOne
- is the first set of propertiessetTwo
- is the second set of propertiesotherName
- name of the type compared topublic EventPropertyDescriptor getPropertyDescriptor(String propertyName)
EventType
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
.
getPropertyDescriptor
in interface EventType
propertyName
- property namepublic EventTypeMetadata getMetadata()
EventTypeSPI
getMetadata
in interface EventTypeSPI
public FragmentEventType getFragmentType(String propertyName)
EventType
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 EventType.getPropertyDescriptors()
method to obtain a list of properties for which a fragment event type
may be retrieved by this method.
getFragmentType
in interface EventType
propertyName
- is the name of the property to return the fragment event typepublic String getEqualsMessage(EventType otherType)
otherType
- to compare topublic boolean equalsCompareType(EventType otherEventType)
equalsCompareType
in interface EventTypeSPI