Class FixedWidthMultiRecordTextSchema

  • All Implemented Interfaces:
    TextSchema

    public class FixedWidthMultiRecordTextSchema
    extends Object
    implements TextSchema
    A schema for a text file containing records with different fixed-width formats. Each record type is uniquely identified by name within the schema. A means of identifying the type of a text record must be provided so that a structured text reader can use the correct parser.
    • Constructor Detail

      • FixedWidthMultiRecordTextSchema

        public FixedWidthMultiRecordTextSchema​(RecordDiscriminator descriminator)
        Defines an empty fixed-width multi-record schema. The specified descriminator is used to determine the actual record schema.

        An empty multi-record schema definition is not meaningful; it is expected that at least one record schema will be defined before the multi-record schema is used.

        Parameters:
        descriminator - descriminator for determining which contained record schema to use for a record
    • Method Detail

      • getTypeCount

        public int getTypeCount()
        Gets the number of record types defined in the schema.
        Returns:
        the number of defined types
      • getTypeNames

        public List<String> getTypeNames()
        Gets the names of the record types defined in the schema.
        Returns:
        a list of defined record types
      • defineRecordType

        public void defineRecordType​(String name,
                                     FixedWidthTextRecord type)
        Defines a record type in the schema.

        No significance is placed on the order in which record types are defined. However, the record identifier is expected to return the index of the type as it appears in getTypeNames().

        Parameters:
        name - the name associated with the record type. The name must be unique amongst all defined types.
        type - describes the record format for the record type
      • getRecordType

        public FixedWidthTextRecord getRecordType​(String name)
        Gets the definition of the specified record type.
        Parameters:
        name - the identifier associated with the record type
        Returns:
        the definition of the record type. If not defined in the schema, null is returned.
      • createRecordIdentifier

        public RecordIdentifier createRecordIdentifier()
        Creates a new record identifier for this schema.
        Returns:
        a record identifier for this schema