Package com.apama.services.scenario
Enum ParameterTypeEnum
- java.lang.Object
-
- java.lang.Enum<ParameterTypeEnum>
-
- com.apama.services.scenario.ParameterTypeEnum
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<ParameterTypeEnum>
public enum ParameterTypeEnum extends java.lang.Enum<ParameterTypeEnum>
Enumeration class to model the "type" of scenario input/output parameters.The following table shows the relationship between the Scenario Service, EPL and Java type systems:
Scenario Service Type EPL Type Java Type string string java.lang.String integer integer java.lang.Long float float java.lang.Double ? decimal DecimalFieldValue
boolean boolean java.lang.Boolean enumeration string java.lang.String
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static boolean
canDecodeString(java.lang.String value, ParameterTypeEnum paramType)
Deprecated.This method is not intended for public use, and will be removed in a future release.static java.lang.Object
decodeString(java.lang.String value, ParameterTypeEnum paramType)
Deprecated.This method is not intended for public use, and will be removed in a future release.static java.lang.Object
displayStringToValue(java.lang.String display, ParameterTypeEnum type)
Convert a locale-sensitive display string for a scenario parameter value of the specified type into a Java object representing its value (e.g.static ParameterTypeEnum
fromScenarioType(java.lang.String stype)
Deprecated.This method is not intended for public use, and will be removed in a future release.java.lang.Class<?>
getJavaType()
Get the Java type (class) that is used to represent parameters of this type.FieldType<?>
getMonitorScriptFieldType()
Get the EPL type that is used to hold values of this scenario parameter type.java.lang.String
getMonitorScriptType()
Get the String name of the EPL type that is used to hold values of this scenario parameter type.java.lang.String
getScenarioType()
Get the type as returned from the correlator.java.lang.String
toString()
Override the toString() method of the Object class to return the scenario type.static ParameterTypeEnum
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static ParameterTypeEnum[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.static java.lang.String
valueToDisplayString(java.lang.Object value)
Convert a Java object representing a value of this type to a locale-sensitive display string suitable for use in user interfaces.
-
-
-
Enum Constant Detail
-
STRING
public static final ParameterTypeEnum STRING
-
INTEGER
public static final ParameterTypeEnum INTEGER
-
FLOAT
public static final ParameterTypeEnum FLOAT
-
DECIMAL
public static final ParameterTypeEnum DECIMAL
-
BOOLEAN
public static final ParameterTypeEnum BOOLEAN
-
ENUMERATION
public static final ParameterTypeEnum ENUMERATION
-
-
Method Detail
-
values
public static ParameterTypeEnum[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (ParameterTypeEnum c : ParameterTypeEnum.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static ParameterTypeEnum valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
getScenarioType
public java.lang.String getScenarioType()
Get the type as returned from the correlator.- Returns:
- a String that specifies the Scenario type, e.g. "enumeration".
-
getMonitorScriptType
public java.lang.String getMonitorScriptType()
Get the String name of the EPL type that is used to hold values of this scenario parameter type.- Returns:
- a String that specifies the MonitorScript type, e.g. "string".
-
getMonitorScriptFieldType
public FieldType<?> getMonitorScriptFieldType()
Get the EPL type that is used to hold values of this scenario parameter type.- Returns:
- A valid FieldType. Never null.
-
getJavaType
public java.lang.Class<?> getJavaType()
Get the Java type (class) that is used to represent parameters of this type.- Returns:
- the java.lang.Class for the corresponding Java type. e.g. java.lang.String
-
toString
public java.lang.String toString()
Override the toString() method of the Object class to return the scenario type. The result is identical to that returned bygetScenarioType()
.- Overrides:
toString
in classjava.lang.Enum<ParameterTypeEnum>
-
valueToDisplayString
public static java.lang.String valueToDisplayString(java.lang.Object value)
Convert a Java object representing a value of this type to a locale-sensitive display string suitable for use in user interfaces.- Parameters:
value
- Must not be null.- Returns:
- A string suitable for display in a user interface e.g. "1,000,000.5". This string can also be passed to
displayStringToValue(String, ParameterTypeEnum)
to convert back to the raw value. Never null. The exact format of these display strings is not guaranteed and may change between releases.
-
displayStringToValue
public static java.lang.Object displayStringToValue(java.lang.String display, ParameterTypeEnum type) throws java.lang.IllegalArgumentException
Convert a locale-sensitive display string for a scenario parameter value of the specified type into a Java object representing its value (e.g. a Long, Double, Boolean, String, etc).- Parameters:
display
- The locale-sensitive display string representation of a value, e.g. "1,000,000.5". If null, returns null.type
- The type of this parameter, which controls how the conversion happens.- Returns:
- The Java object representing this value, whose Java type corresponds to that used by the
Scenario Service and Event Parser, e.g. a Long, Double, Boolean, String, etc. This value can be passed to
valueToDisplayString(Object)
to convert back. - Throws:
java.lang.IllegalArgumentException
- If the specified display string cannot be parsed for this type.
-
fromScenarioType
@Deprecated public static ParameterTypeEnum fromScenarioType(java.lang.String stype) throws java.lang.IllegalArgumentException
Deprecated.This method is not intended for public use, and will be removed in a future release.Static utility method to determine the enum value from the scenario version of a type.- Returns:
- One of the static predefined instances of this class, or null for any error case.
- Throws:
java.lang.IllegalArgumentException
- if the parameter does not represent a valid type.
-
decodeString
@Deprecated public static java.lang.Object decodeString(java.lang.String value, ParameterTypeEnum paramType)
Deprecated.This method is not intended for public use, and will be removed in a future release.Converts the EPL string representation of a parameter value to a Java object, based on its type identifier. Note that this method is for decoding strings in the format used by the Correlator (see also theEventParser
package for more classes to format and parse EPL strings). User interface code should normally use user-friendly locale-sensitive parsing methods instead.If the value cannot be parsed, a warning is logged and a default value is returned; this method should not throw exceptions.
- Parameters:
value
- the stringified value to be decoded, in the format used by the Apama EPL.paramType
- the type identifier to indicate which type to convert to.- Returns:
- an object of the correct type. If the paramType is null, the value will be returned unchanged.
- See Also:
getMonitorScriptFieldType()
-
canDecodeString
@Deprecated public static boolean canDecodeString(java.lang.String value, ParameterTypeEnum paramType)
Deprecated.This method is not intended for public use, and will be removed in a future release.Utility method to check whether a string representation of a parameter value (in the format used by the Correlator) can be converted to a Java object, based on its type identifier.- Parameters:
value
- the stringified value to be decoded, in the format used by the Apama Correlator.paramType
- the type identifier to indicate which type to convert to.- Returns:
- true if it can be decoded, false otherwise. If the paramType is null, return false.
-
-