Interface Header<T>

    • Method Detail

      • get

        default T get​(Row<T> aRow,
                      String aKey)
               throws HeaderMismatchException,
                      ColumnMismatchException
        This method retrieves a value from the Row by taking the index of the according column of this Header of the given key (the one with the given key) and returns that value. This is possible as the values in the row and in the header have an order. This method is a convenience delegate to Row.get(Header, String).
        Parameters:
        aRow - The Row containing the value of the given key.
        aKey - The key for which to retrieve the value.
        Returns:
        The value in the row representing the key in the header.
        Throws:
        HeaderMismatchException - Thrown in case there is a mismatch between the given HeaderMismatchException and the Row, i.e. the index for the given key in the header may be out of index of the given row or the given key does not exist in the Header.
        ColumnMismatchException - in case the type defined in the column for that key does not match the type in the row identified by the given key.
      • toKeys

        default 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 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).
      • isSubsetOf

        default boolean isSubsetOf​(Record<?> aRecord)
        Tests whether the given potential subset of Header elements is matching the Record's elements in terms of matching the same relevant attributes of the Column instances with the elements in the Record. I.e. all Column instances in the subset must match the elements, even if this has more elements. The test also fails (returns false) in case the types of the instances in the Record do not match the according key's type in the Header Column instance or vice versa.
        Parameters:
        aRecord - The Record to be used for testing.
        Returns:
        true in case all columns in the subset match this' elements or the argument passed was null.
      • isEqualWith

        default boolean isEqualWith​(Record<?> aRecord)
        Tests whether the given potential equal set of Header is matching the Record's elements in terms of matching the same relevant attributes of the columns with the elements in the Record. I.e. all Header in the subset must match the elements, and the number of Header must be the same as the number of elements in the Record. The test also fails (returns false) in case the types of the instances in the Record do not match the according key's type in the Header Column instance or vice versa.
        Parameters:
        aRecord - The Record to be used for testing.
        Returns:
        True in case all columns in the subset match this' elements and the number of elements matches the number of columns or the argument passed was null.
      • isSupersetOf

        default boolean isSupersetOf​(Record<?> aRecord)
        Tests whether the Record's elements is matching the given potential superset of Header elements in terms of matching the same relevant attributes of the columns with the elements in the Record. I.e. all elements in the Record must match the Header in the superset, even if the superset has more elements. The test also fails (returns false) in case the types of the instances in the Record do not match the according key's type in the Header Column instance or vice versa.
        Parameters:
        aRecord - The Record to be used for testing.
        Returns:
        True in case all elements in this instance match the columns in the superset or the argument passed was null.
      • isSubsetOf

        default boolean isSubsetOf​(Row<?> aRow)
        Tests whether this Header is a subset of the Row's elements in terms of matching the same relevant attributes of the Header with the elements in the Row. I.e. all Column instances in the subset must match the elements, even if this has more elements. The test also fails (returns false) in case the types of the instances in the Row do not match the according key's type in the Header Column instance or vice versa.
        Parameters:
        aRow - The Row to be used for testing.
        Returns:
        true in case all columns in the subset match this' elements or the argument passed was null.
      • isEqualWith

        default boolean isEqualWith​(Row<?> aRow)
        Tests whether the given potential Header equal set is matching the Row's elements in terms of matching the same relevant attributes of the Header with the elements in the Row. I.e. all Column instances in the subset must match the elements, and the number of columns must be the same as the number of elements in the Row. The test also fails (returns false) in case the types of the instances in the Row do not match the according key's type in the Header Column instance or vice versa.
        Parameters:
        aRow - The Row to be used for testing.
        Returns:
        True in case all columns in the subset match this' elements and the number of elements matches the number of columns or the argument passed was null.
      • isSupersetOf

        default boolean isSupersetOf​(Row<?> aRow)
        Tests whether the Row's elements is matching the given potential Header superset in terms of matching the same relevant attributes of the Header with the elements in the Row. I.e. all elements in the Row must match the Column instances in the superset, even if the superset has more elements. The test also fails (returns false) in case the types of the instances in the Row do not match the according key's type in the Header Column instance or vice versa.
        Parameters:
        aRow - The Row to be used for testing.
        Returns:
        True in case all elements in this instance match the columns in the superset or the argument passed was null.