-
- All Superinterfaces:
Iterable<Field>
,Namespace<Field>
,RecordTyped
,Serializable
,TokenType
,TokenTyped
public interface RecordTokenType extends Namespace<Field>, TokenType, RecordTyped
A description of a record data type. Record types are composite types, constructed from scalar data types. The composition of the record type is described by its schema, a collection of zero or moreField
objects. Record typed objects can typically be decomposed into their constituent scalar typed components.Although decomposable, record typed flows and ports behave as if actual records flow through them. A consequence of this is that each component subflow is expected to have the same total number of elements. A dataflow stemming from a
RecordOutput
is guaranteed to have this property, as it is enforced by theRecordOutput
interface. However, for a dataflow created from an aggregation of scalar flows, it is the responsibility of the aggregator to ensure this.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
checkComparable(TokenType type)
Tests whether tokens of the specified type can be compared to tokens of this type.void
checkFieldTypeConstraint(TokenType constraint)
Checks that all fields of this type are compatible with the specified constraining type.DataRepresentation
getRepresentation()
Returns the representation associated with this type.boolean
isAssignableFrom(TokenType source)
Indicates whether tokens of the specified type are compatible with or implicitly convertible to this type.RecordTokenType
toRepresentation(DataRepresentation representation)
Returns a RecordTokenType, equivalent to this, but whose representation is that specified.-
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Methods inherited from interface com.pervasive.datarush.namespace.Namespace
get, get, getBinding, getBindings, getName, getNames, indexOf, isEmpty, nameSet, size, toList, toList, toMap, verifyNames, verifyNames
-
Methods inherited from interface com.pervasive.datarush.types.RecordTyped
getType
-
Methods inherited from interface com.pervasive.datarush.types.TokenType
dispatchByType, getEncodedByteSize, isAbstract, isComposite, isGeneric, isScalar, name
-
-
-
-
Method Detail
-
isAssignableFrom
boolean isAssignableFrom(TokenType source)
Indicates whether tokens of the specified type are compatible with or implicitly convertible to this type. Only a record type is compatible with or convertible to another record type.For a record type be convertible to this record type, its schema must contain exactly the same field names and the types of each field in the source schema must be convertible to the type of the correspondingly named field in this record schema. Thus the order of fields in the schemas is unimportant, but the names of fields are.
- Specified by:
isAssignableFrom
in interfaceTokenType
- Parameters:
source
- the token type of the source data- Returns:
true
if the source type can be converted.
-
checkComparable
void checkComparable(TokenType type)
Tests whether tokens of the specified type can be compared to tokens of this type. Only a record type can be compared to another record type.For a record type be comparable to this record type, the types of each field in the source schema must be comparable with the type of the field in the same position in this record schema. Thus the names of fields in the schemas are unimportant, but the order of fields is. This is quite different from the behavior of
isAssignableFrom(com.pervasive.datarush.types.TokenType)
. Also implied is that, unlike with scalar types, the comparability of two record types does not imply convertibility from one of the types to the other.- Specified by:
checkComparable
in interfaceTokenType
- Parameters:
type
- the token type of data to compare- Throws:
TypesNotComparableException
- if the two types are not comparable.
-
checkFieldTypeConstraint
void checkFieldTypeConstraint(TokenType constraint)
Checks that all fields of this type are compatible with the specified constraining type.See
TokenType.isAssignableFrom(com.pervasive.datarush.types.TokenType)
for more about compatibility.- Parameters:
constraint
- the type against which to test if fields are constrained- Throws:
FieldTypeNotSupportedException
- if a field does not match the type constraint
-
getRepresentation
DataRepresentation getRepresentation()
Returns the representation associated with this type.- Returns:
- the representation associated with this type.
-
toRepresentation
RecordTokenType toRepresentation(DataRepresentation representation)
Returns a RecordTokenType, equivalent to this, but whose representation is that specified.- Parameters:
representation
- the new representation.- Returns:
- a RecordTokenType, equivalent to this, but whose representation is that specified.
-
-