|
|||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
Class Summary | |
---|---|
BooleanFieldType | Represents the Apama boolean type,
for which values are either Boolean.TRUE or Boolean.FALSE . |
DecimalFieldType | Represents the Apama decimal type,
for which values are specified as DecimalFieldValue objects. |
DecimalFieldValue | Represents the value of an Apama |
DictionaryFieldType<K,V> | Represents the Apama dictionary<key,item> type,
for which values are specified as Map objects. |
EventParser | Provides the functionality to parse String objects into Apama Event objects, for
any EventType registered with the parser. |
EventType | Represents the definition of an Apama event type,
for which values are specified as Event objects. |
Field<T> | Represents the name and type of a field in an EventType . |
FieldType<T> | Represents an Apama type. |
FieldTypes | Provides factory methods and constants for getting all supported Apama event field types. |
FloatFieldType | Represents the Apama float type,
for which values are specified as Double objects. |
IntegerFieldType | Represents the Apama integer type,
for which values are specified as Long objects. |
LocationFieldType | Represents the Apama location type,
for which values are specified as LocationType objects. |
LocationType | Represents the value of an Apama location type,
consisting of of two (x,y) co-ordinates. |
SequenceFieldType<E> | Represents the Apama sequence<type> type,
for which values are specified as List objects. |
StringFieldType | Represents the Apama string type,
for which values are specified as String objects. |
Exception Summary | |
---|---|
ParserRuntimeException | ParserRuntimeException will be thrown when an error occurs while parsing an Apama event. |
Represents the definition of an Apama event type, for which values are specified as
Event
objects.
Each EventType consists of an event type name, and zero or more Field
objects.
Example usage:
static final Field<String> FIELD_MY_STRING = FieldTypes.STRING.newField("myString");
static final Field<List<Double>> FIELD_MY_SEQ = FieldTypes.sequence(FieldTypes.FLOAT).newField("mySeq");
static final Field<Map<String,Long>> FIELD_MY_DICT = FieldTypes.dictionary(FieldTypes.STRING, FieldTypes.INTEGER).newField("myDict");
static final EventType EVENT_NESTED = new EventType("sample.NestedEvent", FIELD_MY_STRING);
static final Field<Event> FIELD_NESTED = EVENT_NESTED.newField("myNested");
static final EventType EVENT_MY_EVENT = new EventType("sample.MyEvent", FIELD_MY_STRING, FIELD_MY_SEQ, FIELD_MY_DICT, FIELD_NESTED);
static final EventParser EVENT_PARSER = new EventParser(EVENT_MY_EVENT);
public void demonstrateParsingAndGettingFieldValues()
{
Event e = EVENT_PARSER.parse("sample.MyEvent(\"Hello\",[1.5,2.3],{\"myDictKey\":123},sample.NestedEvent(\"Nested Hello\"))");
String myString = e.getField(FIELD_MY_STRING);
List<Double> mySeq = e.getField(FIELD_MY_SEQ);
Map<String,Long> myDict = e.getField(FIELD_MY_DICT);
String myString2 = e.getField(FIELD_NESTED).getField(FIELD_MY_STRING);
System.out.println("Field values: "+myString+", "+mySeq+", "+myDict+", "+myString2);
}
public void demonstrateSettingFieldValues()
{
Event e = new Event(EVENT_MY_EVENT)
.setField(FIELD_MY_STRING, "Hello")
.setField(FIELD_MY_SEQ, Arrays.asList(1.5, 2.3D))
.setField(FIELD_MY_DICT, Collections.singletonMap("myDictKey", 123L))
.setField(FIELD_NESTED,
new Event(EVENT_NESTED)
.setField(FIELD_MY_STRING, "Nested Hello")
);
String eventString = e.getText();
System.out.println(eventString);
}
|
|||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |