Package com.apama.event.parser
Class EventParser
- java.lang.Object
-
- com.apama.event.parser.EventParser
-
public class EventParser extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description EventParser(EventType... types)
Constructor to create an EventParser.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
deregisterEventType(EventType type)
Deregister the given event type from being a valid type this parser.static EventParser
getDefaultParser()
Deprecated.EventType
getEventType(java.lang.String name)
Retrieve an Event Type by name.FieldType<?>
getType(java.lang.String typeName)
Retrieve a Type by name.static java.lang.String
getTypeName(java.lang.String eventString)
Method to extract and return the event type name from an event string.Event
parse(java.lang.String eventString)
Parse an event string.void
registerEventType(EventType type)
Register the given event type as being a valid type this parser recognizes.void
registerType(FieldType<?> fieldType)
Register the given field type as being a valid type this parser recognizes.
-
-
-
Constructor Detail
-
EventParser
public EventParser(EventType... types)
Constructor to create an EventParser.- Parameters:
types
- Optional parameter for automatically registering a set of initial event types with the parser.
-
-
Method Detail
-
getDefaultParser
@Deprecated public static EventParser getDefaultParser()
Deprecated.This method is deprecated - create a new EventParser instance using EventParser(params EventType[]) instead")- Returns:
- the singleton EventParser instance.
-
registerEventType
public void registerEventType(EventType type)
Register the given event type as being a valid type this parser recognizes.- Parameters:
type
- the event type to parse
-
getType
public FieldType<?> getType(java.lang.String typeName)
Retrieve a Type by name.- Parameters:
typeName
- The name of the Type- Returns:
- type or null if unknown
-
registerType
public void registerType(FieldType<?> fieldType)
Register the given field type as being a valid type this parser recognizes.- Parameters:
type
- the field type to register
-
deregisterEventType
public void deregisterEventType(EventType type)
Deregister the given event type from being a valid type this parser. recognizes.- Parameters:
type
- the event type to parse
-
getEventType
public EventType getEventType(java.lang.String name)
Retrieve an Event Type by name.- Parameters:
name
- the name of the EventType- Returns:
- the EventType or null if unknown
-
parse
public Event parse(java.lang.String eventString) throws ParserRuntimeException
Parse an event string.- Parameters:
eventString
- the string representation of the event- Returns:
- The resulting Event object
- Throws:
ParserRuntimeException
- if the event string is invalid, or if the EventType of the specified event has not been registered with this EventParser.
-
getTypeName
public static java.lang.String getTypeName(java.lang.String eventString)
Method to extract and return the event type name from an event string. Note that this method will NOT parse the entire event, only the name will be extracted from the eventString.- Parameters:
eventString
- the event string to process- Returns:
- the type name or null if the name cannot be extracted
-
-