Interface EventType
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 interface presents an immutable view of events. There are no methods to change property values. Events by definition are an observation of a past occurrance or state change and may not be modified.
Information on the super-types (superclass and interfaces implemented by JavaBean events) is also available, for Java POJO events as well as for Map event types that has supertypes.
Implementations provide metadata on the properties that an implemenation itself provides.
Implementations also allow property expressioms that may use nested, indexed, mapped or a combination of these as a syntax to access property types and values.
Implementations in addition may provide a means to access property values as event fragments, which are typed events themselves.
The order of property names depends on the underlying event type and may be platform-specific. When the underlying class is object-array the order of property names is always as-provided. When the underlying class is map the order of property names is defined only when LinkedHashMap was used to register the type. When the underlying class is bean the order of property names is depends on the order of the methods returned by reflection.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final EPTypeClass
Type class of EventType.classstatic final EPTypeClass
Type class of EventType[].class -
Method Summary
Modifier and TypeMethodDescriptionReturns 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 the set of deep supertypesReturns the property name of the property providing the end timestamp value.getFragmentType
(String propertyExpression) Returns the event type of the fragment that is the value of a property name or property expression.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.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.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.Returns the type metadata.getName()
Returns the type name or null if no type name is assigned.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.Get property descriptors for the event type.getPropertyEPType
(String propertyExpression) Get the type of an event property with type parameters and null-type indication.String[]
Get the property names for the event type.getPropertyType
(String propertyExpression) Get the type of an event property.Returns the property name of the property providing the start timestamp value.Returns an array of event types that are super to this event type, from which this event type inherited event properties.Get the full type information, including type parameters, that represents the Java type of the event type.Get the class that represents the Java type of the event type.boolean
isProperty
(String propertyExpression) Check that the given property name or property expression is valid for this event type, ie.
-
Field Details
-
EPTYPE
Type class of EventType.class -
EPTYPEARRAY
Type class of EventType[].class
-
-
Method Details
-
getPropertyType
Get the type of an event property.Returns null if the property name or property expression is not valid against the event type. Can also return null for null-value type i.e. 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.
Use
getPropertyEPType(String)
instead for type parameters. The implementation usesgetPropertyEPType(String)
under the hoods.- Parameters:
propertyExpression
- is the property name or property expression- Returns:
- type of the property, the unboxed or the boxed type.
-
getPropertyEPType
Get the type of an event property with type parameters and null-type indication.Returns null if the property name or property expression is not valid against the event type. Returns
EPTypeNull
for null-value 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.
Returns unboxed (such as 'int.class') as well as boxed (java.lang.Integer) type.
- Parameters:
propertyExpression
- is the property name or property expression- Returns:
- type of the property, the unboxed or the boxed type.
-
isProperty
Check that the given property name or property expression is valid for this event type, ie. that the property exists on 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.
- Parameters:
propertyExpression
- is the property name or property expression to check- Returns:
- true if exists, false if not
-
getGetter
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.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.
- Parameters:
propertyExpression
- is the property name or property expression- Returns:
- a getter that can be used to obtain property values for event instances of the same event type
-
getFragmentType
Returns the event type of the fragment that is the value of a property name or property expression.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
getPropertyDescriptors()
method to obtain a list of properties for which a fragment event type may be retrieved by this method.- Parameters:
propertyExpression
- is the name of the property to return the fragment event type- Returns:
- fragment event type of the property
-
getUnderlyingType
Class getUnderlyingType()Get the class that represents the Java type of the event type. UsegetUnderlyingEPType()
to receive the parameterized type.- Returns:
- type of the event object
-
getUnderlyingEPType
EPTypeClass getUnderlyingEPType()Get the full type information, including type parameters, that represents the Java type of the event type.- Returns:
- type including type parameters of the event object
-
getPropertyNames
String[] getPropertyNames()Get the property names for the event type.Note that the order of property names depends on the underlying event type.
The method does not return property names of inner or nested types.
- Returns:
- A string array containing the property names of this typed event data object.
-
getPropertyDescriptors
EventPropertyDescriptor[] getPropertyDescriptors()Get property descriptors for the event type.Note that the order of property names depends on the underlying event type.
The method does not return property information of inner or nested types.
- Returns:
- descriptors for all known properties of the event type.
-
getPropertyDescriptor
Get the property descriptor for a given property of the event, or null if a property by that name was not found.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
.- Parameters:
propertyName
- property name- Returns:
- descriptor for the named property
-
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
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
-
getDeepSuperTypesAsSet
Returns the set of deep supertypes- Returns:
- deep super types
-
getName
String getName()Returns the type name or null if no type name is assigned.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.
- Returns:
- type name or null if none assigned
-
getGetterMapped
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.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.
- Parameters:
mappedPropertyName
- is the property name- Returns:
- a getter that can be used to obtain property values for event instances of the same event type
-
getGetterIndexed
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.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.
- Parameters:
indexedPropertyName
- is the property name- Returns:
- a getter that can be used to obtain property values for event instances of the same event type
-
getStartTimestampPropertyName
String getStartTimestampPropertyName()Returns the property name of the property providing the start timestamp value.- Returns:
- start timestamp property name
-
getEndTimestampPropertyName
String getEndTimestampPropertyName()Returns the property name of the property providing the end timestamp value.- Returns:
- end timestamp property name
-
getMetadata
EventTypeMetadata getMetadata()Returns the type metadata.- Returns:
- type metadata
-