- 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
EnumFlow
is 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 aEnumOutput
is 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 EnumTokenType
ABSTRACT_ENUM
Deprecated.static int
NULL_ORDINAL
Deprecated.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 void
checkComparable(TokenType type)
Deprecated.Tests whether tokens of the specified type can be compared to tokens of this type.void
dispatchByType(TokenTypeDispatcher dispatcher)
Deprecated.Dispatches processing to the type-appropriate method of the specified dispatcher.boolean
equals(Object o)
Deprecated.int
getDefaultOrdinal()
Deprecated.int
getEncodedByteSize()
Deprecated.Gets the expected size, in bytes, for tokens of this type.int
getOrdinal(String value)
Deprecated.Gets the ordinal value of the given value.EnumTokenType
getType()
Deprecated.Gets the type of data tokens handled by the implementor.String
getValue(int ordinal)
Deprecated.Gets the enumerated value with the given ordinal value.int
getValueCount()
Deprecated.Gets the number of values in the enumeration.List<String>
getValues()
Deprecated.Gets the values in the enumeration.int
hashCode()
Deprecated.boolean
isAbstract()
Deprecated.Indicates whether this type is abstract.boolean
isAssignableFrom(TokenType source)
Deprecated.Indicates whether tokens of the specified type are compatible or implicitly convertible to this type.boolean
isComposite()
Deprecated.Indicates whether this type is a composite type.boolean
isGeneric()
Deprecated.Indicates whether this type is the generic type.boolean
isScalar()
Deprecated.Indicates whether this type is a scalar type.boolean
isValidOrdinal(int ordinal)
Deprecated.Indicates whether the given ordinal is valid for the enumeration.boolean
isValidValue(String value)
Deprecated.Indicates whether the given value is valid for the enumeration.String
name()
Deprecated.Gets the printable name of this type.String
toString()
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:TokenType
Gets the printable name of this type.
-
getType
public EnumTokenType getType()
Deprecated.Description copied from interface:TokenTyped
Gets the type of data tokens handled by the implementor.- Specified by:
getType
in interfaceScalarTyped
- Specified by:
getType
in 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
- anyEnumTyped
class- 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:TokenType
Indicates whether this type is a composite type. That is, whether this type describes a structure composed from other types.- Specified by:
isComposite
in interfaceTokenType
- Returns:
- whether this type is composite.
-
isGeneric
public boolean isGeneric()
Deprecated.Description copied from interface:TokenType
Indicates whether this type is the generic type.
-
isScalar
public boolean isScalar()
Deprecated.Description copied from interface:TokenType
Indicates whether this type is a scalar type.
-
isAbstract
public boolean isAbstract()
Deprecated.Description copied from interface:TokenType
Indicates 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:
isAbstract
in 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:
true
if the ordinal specifies a value in the enumeration,false
otherwise
-
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:
true
if the value is in the enumeration,false
otherwise
-
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:TokenType
Indicates whether tokens of the specified type are compatible or implicitly convertible to this type.- Specified by:
isAssignableFrom
in interfaceTokenType
- Parameters:
source
- the token type of the source data- Returns:
true
if the source type can be converted.
-
checkComparable
public void checkComparable(TokenType type)
Deprecated.Description copied from interface:TokenType
Tests 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:
checkComparable
in interfaceTokenType
- Parameters:
type
- the token type of data to compare
-
dispatchByType
public void dispatchByType(TokenTypeDispatcher dispatcher)
Deprecated.Description copied from interface:TokenType
Dispatches 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:
dispatchByType
in interfaceTokenType
- Parameters:
dispatcher
- the class to which to dispatch control
-
getEncodedByteSize
public int getEncodedByteSize()
Deprecated.Description copied from interface:TokenType
Gets 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:
getEncodedByteSize
in interfaceTokenType
- Returns:
- the estimated encoded size of a token of this type.
-
getDefaultOrdinal
public int getDefaultOrdinal()
Deprecated.
-
-