Interface Table

All Known Implementing Classes:
TableImpl

@Immutable public interface Table
An immutable definition of a table.
  • Method Details

    • editor

      static TableEditor editor()
      Obtain an table definition editor that can be used to define a table.
      Returns:
      the editor; never null
    • id

      TableId id()
      Get the identifier for this table.
      Returns:
      the identifier; never null
    • primaryKeyColumnNames

      List<String> primaryKeyColumnNames()
      The list of column names that make up the primary key for this table.
      Returns:
      the immutable list of column names that make up the primary key; never null but possibly empty
    • primaryKeyColumns

      default List<Column> primaryKeyColumns()
      Get the columns that make up the primary key for this table.
      Returns:
      the immutable list of columns that make up the primary key; never null but possibly empty
    • filterColumns

      default List<Column> filterColumns(Predicate<Column> predicate)
      Utility to obtain a copy of a list of the columns that satisfy the specified predicate.
      Parameters:
      predicate - the filter predicate; may not be null
      Returns:
      the list of columns that satisfy the predicate; never null but possibly empty
    • retrieveColumnNames

      List<String> retrieveColumnNames()
      The list of column names that make up this table.

      Note: If feasible, call columns() instead, e.g. if just interested in the number of columns.

      Returns:
      the immutable list of column names ; never null but possibly empty
    • columns

      List<Column> columns()
      Get the definitions for the columns in this table, in the same order in which the table defines them.
      Returns:
      the immutable and ordered list of definitions; never null
    • columnWithName

      Column columnWithName(String name)
      Get the definition for the column in this table with the supplied name. The case of the supplied name does not matter.
      Parameters:
      name - the case-insensitive name of the column
      Returns:
      the column definition, or null if there is no column with the given name
    • defaultCharsetName

      String defaultCharsetName()
      Get the database-specific name of the default character set used by columns in this table.
      Returns:
      the database-specific character set name used by default in columns of this table, or null if there is no such default character set name defined on the table
    • comment

      String comment()
      Get the comment of the table.
      Returns:
      the table comment; may be null if not set
    • attributes

      List<Attribute> attributes()
      Get the attributes of the table.
      Returns:
      the table attributes; may be null if not set
    • attributeWithName

      Attribute attributeWithName(String name)
      Get the definition for an attribute in this table with the supplied name.
      Parameters:
      name - the case-insensitive name of the attribute
      Returns:
      the attribute definition, or null if there is no attribute with the given name
    • isPrimaryKeyColumn

      default boolean isPrimaryKeyColumn(String columnName)
      Determine if the named column is part of the primary key.
      Parameters:
      columnName - the name of the column
      Returns:
      true if a column exists in this table and it is part of the primary key, or false otherwise
    • isAutoIncremented

      default boolean isAutoIncremented(String columnName)
      Determine if the named column is auto-incremented.
      Parameters:
      columnName - the name of the column
      Returns:
      true if a column exists in this table and it is auto-incremented, or false otherwise
    • isGenerated

      default boolean isGenerated(String columnName)
      Determine if the values in the named column is generated by the database.
      Parameters:
      columnName - the name of the column
      Returns:
      true if a column exists in this table and its values are generated, or false otherwise
    • isOptional

      default boolean isOptional(String columnName)
      Determine if the values in the named column is optional.
      Parameters:
      columnName - the name of the column
      Returns:
      true if a column exists in this table and is optional, or false otherwise
    • edit

      TableEditor edit()
      Obtain an editor that contains the same information as this table definition.
      Returns:
      the editor; never null