- All Superinterfaces:
Serializable,TokenTyped
- All Known Subinterfaces:
GenericTokenType,RecordTokenType,ScalarTokenType
- All Known Implementing Classes:
EnumTokenType,ObjectTokenType
Token types are organized in a hierarchy, from most general
to most specific. At the root of the type hierarchy is the
GenericTokenType generic type, which is primarily
used as a place holder denoting any data type. Beneath
this type are two major groups of types:
scalar types and
composite types. Scalars provide
the atomic units of the typing system; composites provide
the ability extend typing in a structured way.
Any type can be used as a place holder for the set of its more specific types. Used on the inputs to an operator, it allows multiple input types to be accepted. Used on the output of an operator, it can denote a variably typed output. In this case the true type is determined from the inputs or settings of the operator. The operator documentation will clarify whether this is the case.
-
Method Summary
Modifier and TypeMethodDescriptionvoidcheckComparable(TokenType type) Tests whether tokens of the specified type can be compared to tokens of this type.voiddispatchByType(TokenTypeDispatcher dispatcher) Dispatches processing to the type-appropriate method of the specified dispatcher.intGets the expected size, in bytes, for tokens of this type.booleanIndicates whether this type is abstract.booleanisAssignableFrom(TokenType source) Indicates whether tokens of the specified type are compatible or implicitly convertible to this type.booleanIndicates whether this type is a composite type.booleanIndicates whether this type is the generic type.booleanisScalar()Indicates whether this type is a scalar type.name()Gets the printable name of this type.Methods inherited from interface com.pervasive.datarush.types.TokenTyped
getType
-
Method Details
-
name
String name()Gets the printable name of this type.- Returns:
- a user-friendly name for this type
-
isComposite
boolean isComposite()Indicates whether this type is a composite type. That is, whether this type describes a structure composed from other types.- Returns:
- whether this type is composite.
-
isGeneric
boolean isGeneric()Indicates whether this type is the generic type.- Returns:
- whether this type is the generic type.
-
isScalar
boolean isScalar()Indicates whether this type is a scalar type.- Returns:
- whether this type is scalar.
-
isAbstract
boolean isAbstract()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.- Returns:
- whether this type is abstract.
-
isAssignableFrom
Indicates whether tokens of the specified type are compatible or implicitly convertible to this type.- Parameters:
source- the token type of the source data- Returns:
trueif the source type can be converted.
-
checkComparable
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.- Parameters:
type- the token type of data to compare- Throws:
TypesNotComparableException- if the two types are not comparable.
-
getEncodedByteSize
int getEncodedByteSize()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.- Returns:
- the estimated encoded size of a token of this type.
-
dispatchByType
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.- Parameters:
dispatcher- the class to which to dispatch control
-