Interface Table

All Known Implementing Classes:
TableImpl

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

    Modifier and Type
    Method
    Description
    Get the definitions for the columns in this table, in the same order in which the table defines them.
    Get the definition for the column in this table with the supplied name.
    Get the comment of the table.
    Get the database-specific name of the default character set used by columns in this table.
    Obtain an editor that contains the same information as this table definition.
    Obtain an table definition editor that can be used to define a table.
    default List<Column>
    Utility to obtain a copy of a list of the columns that satisfy the specified predicate.
    id()
    Get the identifier for this table.
    default boolean
    Determine if the named column is auto-incremented.
    default boolean
    isGenerated(String columnName)
    Determine if the values in the named column is generated by the database.
    default boolean
    isOptional(String columnName)
    Determine if the values in the named column is optional.
    default boolean
    Determine if the named column is part of the primary key.
    The list of column names that make up the primary key for this table.
    default List<Column>
    Get the columns that make up the primary key for this table.
    The list of column names that make up this 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
    • 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