Interface RecordTokenType

  • 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 more Field 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 the RecordOutput interface. However, for a dataflow created from an aggregation of scalar flows, it is the responsibility of the aggregator to ensure this.

    • 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 interface TokenType
        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 interface TokenType
        Parameters:
        type - the token type of data to compare
        Throws:
        TypesNotComparableException - if the two types are not comparable.
      • 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.