Class Table

    • Constructor Detail

      • Table

        public Table​(String id,
                     String description,
                     Collection<Column<?>> columns)
        Constructor.
        Parameters:
        id - String; id
        description - String; description
        columns - Collection<Column<?>>; columns
        Throws:
        NullPointerException - when id, description or columns is null
        IllegalArgumentException - when id is empty, duplicate column ids, or there are zero columns
    • Method Detail

      • getDescription

        public String getDescription()
        Returns the description.
        Returns:
        description
      • getColumns

        public ImmutableList<Column<?>> getColumns()
        Returns the list of columns.
        Returns:
        list of columns
      • getColumn

        public Column<?> getColumn​(int columnNumber)
        Return a specific column.
        Parameters:
        columnNumber - int; number of the column.
        Returns:
        Column<?>; column.
        Throws:
        IllegalArgumentException - if the column number is < 0 or > getNumberOfColumns() - 1.
      • getNumberOfColumns

        public int getNumberOfColumns()
        Returns the number of columns.
        Returns:
        number of columns
      • getColumnNumber

        public int getColumnNumber​(Column<?> column)
        Returns the number of the column in this table.
        Parameters:
        column - Column<?>; column.
        Returns:
        int; column number.
        Throws:
        IllegalArgumentException - if the column is not in the table.
      • getColumnNumber

        public int getColumnNumber​(String columnId)
        Returns the number of the column with given id.
        Parameters:
        columnId - String; column id.
        Returns:
        int; column number.
        Throws:
        IllegalArgumentException - if the column is not in the table.
      • getColumnIds

        public String[] getColumnIds()
        Return the column ids as a String[].
        Returns:
        String[]; the column ids
      • getColumnDescriptions

        public String[] getColumnDescriptions()
        Return the column descriptions as a String[].
        Returns:
        String[] the column headers
      • getColumnDataTypes

        public Class<?>[] getColumnDataTypes()
        Return the column data types as a Class<?>[].
        Returns:
        Class<?>[] the column data types
      • getColumnDataTypeStrings

        public String[] getColumnDataTypeStrings()
        Return the column data types as a String[]. Each data type is presented as the full class name or the primitive name. In case of an array, the result is preceded by an "[" for each dimension. After one or more "[" symbols, the class name is preceded by an "L" for a non-primitive class or interface, and by "I" for integer, "Z" for boolean, "B" for byte, "C" for char, "D" for double, "F" for float, "J" for long and "S" for short. So for a column with a double, "double" is returned. For a column with a "Double", "java.lang.Double" is returned, for an int[][], "[[I" is returned, and for a Long[], "[Ljava.lang.Long" is returned.
        Returns:
        String[] the column data types as an array of Strings
      • isEmpty

        public abstract boolean isEmpty()
        Returns whether the table is empty.
        Returns:
        whether the table is empty