Interface Header<T>

  • Type Parameters:
    T - The type managed by the Header.
    All Superinterfaces:
    org.refcodes.structure.Clearable, java.util.Collection<T>, ColumnRow<T,C>, HeaderRow<T,Column<? extends T>>, java.lang.Iterable<T>, org.refcodes.structure.Keys<T,C>, org.refcodes.structure.Keys.MutableKeys<T,C>, java.util.List<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).