public class EventType extends FieldType<Event>
Event
objects.
Each EventType consists of an event type name, and zero or more Field
objects.
Example usage can be found at the top level of this package.
Threading: The EventType class is not fully thread-safe, but once it has been initialized with all the required fields, it is safe to concurrently use it to parse and create event strings from any thread, provided fields are not added or removed from the event type (this would not happen in typical usage anyway).
Constructor and Description |
---|
EventType(java.lang.String name,
Field<?>... fields)
Create a new Event Type by specifying the name of the event and the
FieldType of each of the event parameter.
|
Modifier and Type | Method and Description |
---|---|
void |
addField(Field<?> field)
Method to append extra field to the EventType.
|
<T> void |
addField(java.lang.String name,
FieldType<T> fieldType)
Method to append extra field to the EventType.
|
void |
assertAssignable(java.lang.Object c,
java.lang.String fieldName)
This method is intended for internal use only and may be removed at any time - do not use.
|
Event |
defaultValue()
Get the default value for Event field type.
|
boolean |
equals(java.lang.Object obj)
equals if both objects has same field names/types
|
boolean |
fieldExists(java.lang.String fieldName,
FieldType<?> fieldType)
Method to check if this EventType contains a field with name fieldName
AND type fieldType.
|
Field<?> |
getField(java.lang.String fieldName)
Get a named field.
|
java.lang.String[] |
getFieldNames()
Method to retrieve the field names as String array for the event.
|
int |
hashCode() |
Event |
parse(java.lang.String value)
Convert a value of this type from the format used in Apama event strings, into
an Event object.
|
java.lang.String |
toString()
Returns a String representation of the event type.
|
format, getName, getTypeClass, newField
public EventType(java.lang.String name, Field<?>... fields)
name
- The name of this typefields
- Array of field definitions for each event parameterpublic void addField(Field<?> field)
field
- a new field to append to the eventTypepublic <T> void addField(java.lang.String name, FieldType<T> fieldType)
name
- name of the fieldfieldType
- of the new field to be addedpublic java.lang.String[] getFieldNames()
public Field<?> getField(java.lang.String fieldName)
fieldName
- The fieldName to checkpublic boolean fieldExists(java.lang.String fieldName, FieldType<?> fieldType)
fieldName
- The fieldName to checkfieldType
- The fieldType to matchpublic void assertAssignable(java.lang.Object c, java.lang.String fieldName)
FieldType
assertAssignable
in class FieldType<Event>
public Event parse(java.lang.String value) throws ParserRuntimeException
parse
in class FieldType<Event>
value
- the value to parse.ParserRuntimeException
- If the specified value string cannot be parsed.public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
public Event defaultValue()
defaultValue
in class FieldType<Event>
Submit a bug or feature
Copyright (c) 2013-2017 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors. Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG.