- java.lang.Object
-
- com.pervasive.datarush.types.EnumTokenType
-
- All Implemented Interfaces:
ScalarTokenType,ScalarTyped,TokenType,TokenTyped,Serializable
public class EnumTokenType extends Object implements ScalarTokenType
Deprecated.Replace with string+domainA description of a scalar data type for a set of fixed string values. This is an extension of the concept of the string datatype. Because the range of values is restricted to the enumerated values, DataRush can handle them more efficiently than strings. Additionally, values can be validated to ensure they are within the specified set.Since enumerated values are strings, read-only interfaces for objects of an enumerated data type can also be used as string typed objects. So, for instance, a
EnumFlowis also aStringFlow. The converse, however, is not true, since string values may fall outside the accepted value set. Thus it is not the case that aEnumOutputis also aStringOutput, since input validation errors can be raised which are not expected.Enumerated data types are only compatible with themselves. It is not possible to compare two enumerated types unless the types are equal - which is only true if the enumerations specify the same values in the same order.
To define a enumerate token type, use
TokenTypeConstant#ENUM(LIST)to obtain an instance describing the type.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static EnumTokenTypeABSTRACT_ENUMDeprecated.static intNULL_ORDINALDeprecated.The ordinal value used for null.
-
Constructor Summary
Constructors Constructor Description EnumTokenType(EnumeratedValues values)Deprecated.EnumTokenType(List<String> values)Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidcheckComparable(TokenType type)Deprecated.Tests whether tokens of the specified type can be compared to tokens of this type.voiddispatchByType(TokenTypeDispatcher dispatcher)Deprecated.Dispatches processing to the type-appropriate method of the specified dispatcher.booleanequals(Object o)Deprecated.intgetDefaultOrdinal()Deprecated.intgetEncodedByteSize()Deprecated.Gets the expected size, in bytes, for tokens of this type.intgetOrdinal(String value)Deprecated.Gets the ordinal value of the given value.EnumTokenTypegetType()Deprecated.Gets the type of data tokens handled by the implementor.StringgetValue(int ordinal)Deprecated.Gets the enumerated value with the given ordinal value.intgetValueCount()Deprecated.Gets the number of values in the enumeration.List<String>getValues()Deprecated.Gets the values in the enumeration.inthashCode()Deprecated.booleanisAbstract()Deprecated.Indicates whether this type is abstract.booleanisAssignableFrom(TokenType source)Deprecated.Indicates whether tokens of the specified type are compatible or implicitly convertible to this type.booleanisComposite()Deprecated.Indicates whether this type is a composite type.booleanisGeneric()Deprecated.Indicates whether this type is the generic type.booleanisScalar()Deprecated.Indicates whether this type is a scalar type.booleanisValidOrdinal(int ordinal)Deprecated.Indicates whether the given ordinal is valid for the enumeration.booleanisValidValue(String value)Deprecated.Indicates whether the given value is valid for the enumeration.Stringname()Deprecated.Gets the printable name of this type.StringtoString()Deprecated.<T extends EnumTokenType>
TvalidateType(T other)Deprecated.Checks whether the given object is using the same enumeration as the type.
-
-
-
Field Detail
-
NULL_ORDINAL
public static final int NULL_ORDINAL
Deprecated.The ordinal value used for null.- See Also:
- Constant Field Values
-
ABSTRACT_ENUM
public static final EnumTokenType ABSTRACT_ENUM
Deprecated.
-
-
Constructor Detail
-
EnumTokenType
public EnumTokenType(EnumeratedValues values)
Deprecated.
-
-
Method Detail
-
name
public String name()
Deprecated.Description copied from interface:TokenTypeGets the printable name of this type.
-
getType
public EnumTokenType getType()
Deprecated.Description copied from interface:TokenTypedGets the type of data tokens handled by the implementor.- Specified by:
getTypein interfaceScalarTyped- Specified by:
getTypein interfaceTokenTyped- Returns:
- the type of tokens associated with the class.
-
validateType
public <T extends EnumTokenType> T validateType(T other)
Deprecated.Checks whether the given object is using the same enumeration as the type.- Type Parameters:
T- anyEnumTypedclass- Parameters:
other- the enumeration typed object to test- Returns:
- the given object
- Throws:
IllegalArgumentException- if the enumerations are not identical
-
isComposite
public boolean isComposite()
Deprecated.Description copied from interface:TokenTypeIndicates whether this type is a composite type. That is, whether this type describes a structure composed from other types.- Specified by:
isCompositein interfaceTokenType- Returns:
- whether this type is composite.
-
isGeneric
public boolean isGeneric()
Deprecated.Description copied from interface:TokenTypeIndicates whether this type is the generic type.
-
isScalar
public boolean isScalar()
Deprecated.Description copied from interface:TokenTypeIndicates whether this type is a scalar type.
-
isAbstract
public boolean isAbstract()
Deprecated.Description copied from interface:TokenTypeIndicates whether this type is abstract. Scalar types are never abstract. The generic type always is. Composite types are abstract if either: they are comprised of no fields or they contain an abstract type.- Specified by:
isAbstractin interfaceTokenType- Returns:
- whether this type is abstract.
-
getValueCount
public int getValueCount()
Deprecated.Gets the number of values in the enumeration.- Returns:
- the count of the enumerated values
-
getValues
public List<String> getValues()
Deprecated.Gets the values in the enumeration. These will be returned in enumeration order.- Returns:
- the possible values of the enumeration
-
isValidOrdinal
public boolean isValidOrdinal(int ordinal)
Deprecated.Indicates whether the given ordinal is valid for the enumeration.- Parameters:
ordinal- the ordinal value to test- Returns:
trueif the ordinal specifies a value in the enumeration,falseotherwise
-
getValue
public String getValue(int ordinal)
Deprecated.Gets the enumerated value with the given ordinal value.- Parameters:
ordinal- the ordinal value identifying the enumeration value- Returns:
- the value associated with the ordinal
- Throws:
IndexOutOfBoundsException- if the ordinal is not valid for the type.
-
isValidValue
public boolean isValidValue(String value)
Deprecated.Indicates whether the given value is valid for the enumeration.- Parameters:
value- the value to test- Returns:
trueif the value is in the enumeration,falseotherwise
-
getOrdinal
public int getOrdinal(String value)
Deprecated.Gets the ordinal value of the given value.- Parameters:
value- the enumeration value for which to get the ordinal- Returns:
- the ordinal value of the enumerated value
- Throws:
IndexOutOfBoundsException- if the value is not valid for the type.
-
isAssignableFrom
public boolean isAssignableFrom(TokenType source)
Deprecated.Description copied from interface:TokenTypeIndicates whether tokens of the specified type are compatible or implicitly convertible to this type.- Specified by:
isAssignableFromin interfaceTokenType- Parameters:
source- the token type of the source data- Returns:
trueif the source type can be converted.
-
checkComparable
public void checkComparable(TokenType type)
Deprecated.Description copied from interface:TokenTypeTests whether tokens of the specified type can be compared to tokens of this type. For two types to be comparable, at least one type must be implicitly convertible to the other.- Specified by:
checkComparablein interfaceTokenType- Parameters:
type- the token type of data to compare
-
dispatchByType
public void dispatchByType(TokenTypeDispatcher dispatcher)
Deprecated.Description copied from interface:TokenTypeDispatches processing to the type-appropriate method of the specified dispatcher. This is used in generic code to perform type-specific actions based on other input; a rather common case is object construction, where the dispatcher is usually derived fromTypeDispatchedConstructor.- Specified by:
dispatchByTypein interfaceTokenType- Parameters:
dispatcher- the class to which to dispatch control
-
getEncodedByteSize
public int getEncodedByteSize()
Deprecated.Description copied from interface:TokenTypeGets the expected size, in bytes, for tokens of this type. For variable sized types, such as binary data or strings, this is a guess of the average size.- Specified by:
getEncodedByteSizein interfaceTokenType- Returns:
- the estimated encoded size of a token of this type.
-
getDefaultOrdinal
public int getDefaultOrdinal()
Deprecated.
-
-