Interface RecordMetaData

  • All Known Implementing Classes:
    RecordMetaDataImpl

    public interface RecordMetaData
    Metadata with information about Records parsed from the input.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean containsColumn​(java.lang.String headerName)
      Queries whether a given header name exists in the Records parsed from the input
      FieldSet<java.lang.String> convertFields​(Conversion... conversions)
      Associates a sequence of Conversions to fields of a given set of field names
      <T extends java.lang.Enum<T>>
      FieldSet<T>
      convertFields​(java.lang.Class<T> enumType, Conversion... conversions)
      Associates a sequence of Conversions to fields of a given set of fields
      FieldSet<java.lang.Integer> convertIndexes​(Conversion... conversions)
      Associates a sequence of Conversions to fields of a given set of column indexes
      java.lang.Object defaultValueOf​(int columnIndex)
      Returns the default value associated with a column (defined using setDefaultValueOf(Column, Object))
      java.lang.Object defaultValueOf​(java.lang.Enum<?> column)
      Returns the default value associated with a column (defined using setDefaultValueOf(Column, Object))
      java.lang.Object defaultValueOf​(java.lang.String headerName)
      Returns the default value associated with a column (defined using setDefaultValueOf(Column, Object))
      java.lang.String[] headers()
      Returns the column names of the Records parsed from the input.
      int indexOf​(java.lang.Enum<?> column)
      Returns the index of a given column
      int indexOf​(java.lang.String headerName)
      Returns the index of a given column
      java.lang.String[] selectedHeaders()
      Returns the sequence of headers that have been selected.
      <T> void setDefaultValueOfColumns​(T defaultValue, int... columnIndexes)
      Associates a default value with one or more columns, in case the values contained are null
      <T> void setDefaultValueOfColumns​(T defaultValue, java.lang.Enum<?>... columns)
      Associates a default value with one or more columns, in case the values contained are null
      <T> void setDefaultValueOfColumns​(T defaultValue, java.lang.String... headerNames)
      Associates a default value with one or more columns, in case the values contained are null
      void setTypeOfColumns​(java.lang.Class<?> type, int... columnIndexes)
      Associates a type with one or more column.
      void setTypeOfColumns​(java.lang.Class<?> type, java.lang.Enum... columns)
      Associates a type with one or more column.
      void setTypeOfColumns​(java.lang.Class<?> type, java.lang.String... headerNames)
      Associates a type with one or more column.
      java.lang.Class<?> typeOf​(int columnIndex)
      Returns the type associated with a given column, defined with the method setTypeOfColumns(type, columns)
      java.lang.Class<?> typeOf​(java.lang.Enum<?> column)
      Returns the type associated with a given column, defined with the method setTypeOfColumns(type, columns)
      java.lang.Class<?> typeOf​(java.lang.String headerName)
      Returns the type associated with a given column name, defined with the method setTypeOfColumns(type, columns)
    • Method Detail

      • indexOf

        int indexOf​(java.lang.Enum<?> column)
        Returns the index of a given column
        Parameters:
        column - the column whose index will be returned
        Returns:
        index of the given column
      • indexOf

        int indexOf​(java.lang.String headerName)
        Returns the index of a given column
        Parameters:
        headerName - name of the column whose index will be returned
        Returns:
        index of the given column
      • typeOf

        java.lang.Class<?> typeOf​(java.lang.Enum<?> column)
        Returns the type associated with a given column, defined with the method setTypeOfColumns(type, columns)
        Parameters:
        column - the column whose type will be returned
        Returns:
        the type of the given column
      • typeOf

        java.lang.Class<?> typeOf​(java.lang.String headerName)
        Returns the type associated with a given column name, defined with the method setTypeOfColumns(type, columns)
        Parameters:
        headerName - name of the column whose type will be returned
        Returns:
        the type of the given column
      • typeOf

        java.lang.Class<?> typeOf​(int columnIndex)
        Returns the type associated with a given column, defined with the method setTypeOfColumns(type, columns)
        Parameters:
        columnIndex - the position of the column whose type will be returned
        Returns:
        the type of the given column
      • setTypeOfColumns

        void setTypeOfColumns​(java.lang.Class<?> type,
                              java.lang.Enum... columns)
        Associates a type with one or more column. This allows the parsed data to be converted automatically to the given type when reading data from a Record, e.g. Record.toFieldObjectMap(String...) will convert the selected field values to their respective types, and then set the result as the values in the map.
        Parameters:
        type - the type to associate with a list of column
        columns - the columns that will be associated with the given type.
      • setTypeOfColumns

        void setTypeOfColumns​(java.lang.Class<?> type,
                              java.lang.String... headerNames)
        Associates a type with one or more column. This allows the parsed data to be converted automatically to the given type when reading data from a Record, e.g. Record.toFieldObjectMap(String...) will convert the selected field values to their respective types, and then set the result as the values in the map.
        Parameters:
        type - the type to associate with a list of column
        headerNames - the columns that will be associated with the given type.
      • setTypeOfColumns

        void setTypeOfColumns​(java.lang.Class<?> type,
                              int... columnIndexes)
        Associates a type with one or more column. This allows the parsed data to be converted automatically to the given type when reading data from a Record, e.g. Record.toFieldObjectMap(String...) will convert the selected field values to their respective types, and then set the result as the values in the map.
        Parameters:
        type - the type to associate with a list of column
        columnIndexes - the columns that will be associated with the given type.
      • setDefaultValueOfColumns

        <T> void setDefaultValueOfColumns​(T defaultValue,
                                          java.lang.Enum<?>... columns)
        Associates a default value with one or more columns, in case the values contained are null
        Type Parameters:
        T - type of the default value.
        Parameters:
        defaultValue - the value to be used for the given column when the parsed result is null
        columns - the columns to be associated with a default value.
      • setDefaultValueOfColumns

        <T> void setDefaultValueOfColumns​(T defaultValue,
                                          java.lang.String... headerNames)
        Associates a default value with one or more columns, in case the values contained are null
        Type Parameters:
        T - type of the default value.
        Parameters:
        defaultValue - the value to be used for the given column when the parsed result is null
        headerNames - the column names to be associated with a default value.
      • setDefaultValueOfColumns

        <T> void setDefaultValueOfColumns​(T defaultValue,
                                          int... columnIndexes)
        Associates a default value with one or more columns, in case the values contained are null
        Type Parameters:
        T - type of the default value.
        Parameters:
        defaultValue - the value to be used for the given column when the parsed result is null
        columnIndexes - the column indexes to be associated with a default value.
      • defaultValueOf

        java.lang.Object defaultValueOf​(java.lang.Enum<?> column)
        Returns the default value associated with a column (defined using setDefaultValueOf(Column, Object))
        Parameters:
        column - the column whose default value will be returned
        Returns:
        the default value associated with the given column or null.
      • defaultValueOf

        java.lang.Object defaultValueOf​(java.lang.String headerName)
        Returns the default value associated with a column (defined using setDefaultValueOf(Column, Object))
        Parameters:
        headerName - the column name whose default value will be returned
        Returns:
        the default value associated with the given column or null.
      • defaultValueOf

        java.lang.Object defaultValueOf​(int columnIndex)
        Returns the default value associated with a column (defined using setDefaultValueOf(Column, Object))
        Parameters:
        columnIndex - the column index whose default value will be returned
        Returns:
        the default value associated with the given column or null.
      • convertFields

        <T extends java.lang.Enum<T>> FieldSet<T> convertFields​(java.lang.Class<T> enumType,
                                                                Conversion... conversions)
        Associates a sequence of Conversions to fields of a given set of fields
        Type Parameters:
        T - the enumeration type
        Parameters:
        enumType - the type of the enumeration whose values represent headers in the input Records
        conversions - the sequence of conversions to apply
        Returns:
        (modifiable) set of fields to be selected and against which the given conversion sequence will be applied.
      • convertFields

        FieldSet<java.lang.String> convertFields​(Conversion... conversions)
        Associates a sequence of Conversions to fields of a given set of field names
        Parameters:
        conversions - the sequence of conversions to apply
        Returns:
        (modifiable) set of fields names to be selected and against which the given conversion sequence will be applied.
      • convertIndexes

        FieldSet<java.lang.Integer> convertIndexes​(Conversion... conversions)
        Associates a sequence of Conversions to fields of a given set of column indexes
        Parameters:
        conversions - the sequence of conversions to apply
        Returns:
        (modifiable) set of column indexes to be selected and against which the given conversion sequence will be applied.
      • headers

        java.lang.String[] headers()
        Returns the column names of the Records parsed from the input.

        If the headers are extracted from the input (i.e. CommonParserSettings.isHeaderExtractionEnabled() == true), then these values will be returned.

        If no headers are extracted from the input, then the configured headers in CommonSettings.getHeaders() will be returned.

        Returns:
        the headers associated with the Records parsed from the input
      • selectedHeaders

        java.lang.String[] selectedHeaders()
        Returns the sequence of headers that have been selected. If no selection has been made, all available headers will be returned, producing the same output as a call to method headers().
        Returns:
        the sequence of selected headers, or all headers if no selection has been made.
      • containsColumn

        boolean containsColumn​(java.lang.String headerName)
        Queries whether a given header name exists in the Records parsed from the input
        Parameters:
        headerName - name of the header
        Returns:
        true if the given header name exists in the input records, otherwise false