Interface Header<T>

  • Type Parameters:
    T - The type managed by the Header.
    All Superinterfaces:
    org.refcodes.structure.Clearable, java.util.Collection<Column<? extends T>>, ColumnRow<T,Column<? extends T>>, HeaderRow<T,Column<? extends T>>, java.lang.Iterable<Column<? extends T>>, org.refcodes.structure.Keys<java.lang.String,Column<? extends T>>, org.refcodes.structure.Keys.MutableKeys<java.lang.String,Column<? extends T>>, java.util.List<Column<? extends T>>
    All Known Implementing Classes:
    HeaderImpl

    public interface Header<T>
    extends HeaderRow<T,Column<? extends T>>
    A list of Column instances, for example describing the elements of a CSV file (visually speaking the of the CSV file's header line), is represented by the Header. The Header preserves an order for a list of Column instances. A Header provides the semantics for related Row instances.

    The Keys.keySet() method must provide a predictable order as ensured by the LinkedHashSet class as of the ordered nature of the Header.

    • Method Detail

      • toKeys

        default java.lang.String[] toKeys()
        Returns the keys of the Header in the intended order.
        Returns:
        The keys of the Header in correct order.
      • toValues

        default T[] toValues​(Record<T> aRecord)
        Returns an array of the values stored by the Record in the order as defined by the header.
        Parameters:
        aRecord - The Record to be converted to an array of values.
        Returns:
        The array of values.
      • toType

        default java.lang.Class<T> toType()
        Determines the least common denominator type by evaluating the Column instances contained within this Header.
        Returns:
        Determines the lest common denominator type or null (in case there are no Column instances in the Header).