Package com.apama.event.parser
Class FieldType<T>
- java.lang.Object
-
- com.apama.event.parser.FieldType<T>
-
- Type Parameters:
T
- The Java type used for field values of this type.
- Direct Known Subclasses:
AnyFieldType
,BooleanFieldType
,ChannelFieldType
,DecimalFieldType
,DictionaryFieldType
,EventType
,FloatFieldType
,IntegerFieldType
,LocationFieldType
,OptionalFieldType
,SequenceFieldType
,StringFieldType
public abstract class FieldType<T> extends java.lang.Object
Represents an Apama type. Used to define the type of fields in anEventType
, and also for type parameters in complex types such asDictionaryFieldType
. Get field type objects usingFieldTypes
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract 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.abstract T
defaultValue()
Get the default value for this field type.java.lang.String
format(java.lang.Object value)
Format the given value in MonitorScript representation.java.lang.String
getName()
Return the name of this type.java.lang.Class<? super T>
getTypeClass()
Return the Java type used for parsed values of this field type.Field<T>
newField(java.lang.String name)
Creates a new Field object with the specified name, using this field type.T
parse(java.lang.String value)
Parse an Apama string representation of this field type into an object representing its value.java.lang.String
toString()
Returns a String representation of the field type.
-
-
-
Method Detail
-
newField
public Field<T> newField(java.lang.String name)
Creates a new Field object with the specified name, using this field type. This is exactly the same as calling the Field constructor, but involves less typing because Java will automatically infer the generic type parameters.- Parameters:
name
- The field name- Returns:
- A new Field object
-
getName
public java.lang.String getName()
Return the name of this type.- Returns:
- the type name
-
getTypeClass
public java.lang.Class<? super T> getTypeClass()
Return the Java type used for parsed values of this field type.- Returns:
- the the Java type used for parsed values of this field type.
-
format
public java.lang.String format(java.lang.Object value)
Format the given value in MonitorScript representation.- Parameters:
value
- the value to format- Returns:
- the formatted value
-
parse
public T parse(java.lang.String value) throws ParserRuntimeException
Parse an Apama string representation of this field type into an object representing its value.- Parameters:
value
- the value to parse- Returns:
- an object specifying the value, the type of which depends on which class this method is called on.
- Throws:
ParserRuntimeException
- if some problem occurs
-
assertAssignable
public abstract 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.
-
toString
public java.lang.String toString()
Returns a String representation of the field type. Note that this representation will use the Java toString() method to format the results, and is not valid monitorscript.- Overrides:
toString
in classjava.lang.Object
-
defaultValue
public abstract T defaultValue()
Get the default value for this field type.- Returns:
-
-