public class EnumTokenType extends Object implements ScalarTokenType
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 a StringFlow
. The converse, however, is not
true, since string values may fall outside the accepted value
set. Thus it is not the case that a EnumOutput
is also
a StringOutput
, 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.
Modifier and Type | Field and Description |
---|---|
static EnumTokenType |
ABSTRACT_ENUM
Deprecated.
|
static int |
NULL_ORDINAL
Deprecated.
The ordinal value used for null.
|
Constructor and Description |
---|
EnumTokenType(EnumeratedValues values)
Deprecated.
|
EnumTokenType(List<String> values)
Deprecated.
|
Modifier and Type | Method and 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> |
validateType(T other)
Deprecated.
Checks whether the given object is using the same enumeration
as the type.
|
public static final int NULL_ORDINAL
public static final EnumTokenType ABSTRACT_ENUM
public EnumTokenType(EnumeratedValues values)
public String name()
TokenType
public EnumTokenType getType()
TokenTyped
getType
in interface ScalarTyped
getType
in interface TokenTyped
public <T extends EnumTokenType> T validateType(T other)
T
- any EnumTyped
classother
- the enumeration typed object to testIllegalArgumentException
- if the enumerations are not identicalpublic boolean isComposite()
TokenType
isComposite
in interface TokenType
public boolean isGeneric()
TokenType
public boolean isScalar()
TokenType
public boolean isAbstract()
TokenType
isAbstract
in interface TokenType
public int getValueCount()
public List<String> getValues()
public boolean isValidOrdinal(int ordinal)
ordinal
- the ordinal value to testtrue
if the ordinal specifies a
value in the enumeration, false
otherwisepublic String getValue(int ordinal)
ordinal
- the ordinal value identifying the
enumeration valueIndexOutOfBoundsException
- if the ordinal is not valid
for the type.public boolean isValidValue(String value)
value
- the value to testtrue
if the value is in the enumeration,
false
otherwisepublic int getOrdinal(String value)
value
- the enumeration value for which to
get the ordinalIndexOutOfBoundsException
- if the value is not valid
for the type.public boolean isAssignableFrom(TokenType source)
TokenType
isAssignableFrom
in interface TokenType
source
- the token type of the source datatrue
if the source type can be
converted.public void checkComparable(TokenType type)
TokenType
checkComparable
in interface TokenType
type
- the token type of data to comparepublic void dispatchByType(TokenTypeDispatcher dispatcher)
TokenType
TypeDispatchedConstructor
.dispatchByType
in interface TokenType
dispatcher
- the class to which to dispatch controlpublic int getEncodedByteSize()
TokenType
getEncodedByteSize
in interface TokenType
public int getDefaultOrdinal()
Copyright © 2016 Actian Corporation. All rights reserved.