Class Table<ENTITY extends Table<?>>

java.lang.Object
io.github.torand.fastersql.model.Table<ENTITY>
Type Parameters:
ENTITY - the concrete table class with columns.
All Implemented Interfaces:
Relation, Sql

public abstract class Table<ENTITY extends Table<?>> extends Object implements Relation
Models a database table.
  • Constructor Details

    • Table

      protected Table(String name, TableFactory<ENTITY> tableFactory)
      Creates a representation (model) of a database table.
      Parameters:
      name - the table name.
      tableFactory - the instance factory.
    • Table

      protected Table(String name, String alias, TableFactory<ENTITY> tableFactory)
      Creates a representation (model) of a database table.
      Parameters:
      name - the table name.
      alias - the table alias.
      tableFactory - the instance factory.
  • Method Details

    • column

      public Column column(String name)
      Creates a model of a column belonging to this table.
      Parameters:
      name - the column name.
      Returns:
      the column model.
    • name

      public String name()
      Gets the table name.
      Returns:
      the table name.
    • sql

      public String sql(Context context)
      Description copied from interface: Sql
      Formats object as an SQL fragment.
      Specified by:
      sql in interface Sql
      Parameters:
      context - the context (incl. dialect).
      Returns:
      the formatted SQL fragment.
    • params

      public Stream<Object> params(Context context)
      Description copied from interface: Sql
      Gets the statement parameters introduced by this fragment.
      Specified by:
      params in interface Sql
      Parameters:
      context - the context (incl. dialect).
      Returns:
      the statement parameters.
    • columnRefs

      public Stream<Column> columnRefs()
      Description copied from interface: Sql
      Gets the columns referenced by this fragment. For validation purposes.
      Specified by:
      columnRefs in interface Sql
      Returns:
      the columns referenced by this fragment.
    • aliasRefs

      public Stream<ColumnAlias> aliasRefs()
      Description copied from interface: Sql
      Gets the column aliases referenced by this fragment. For validation purposes.
      Specified by:
      aliasRefs in interface Sql
      Returns:
      the column aliases referenced by this fragment.
    • as

      public ENTITY as(String alias)
      Description copied from interface: Relation
      Specifies the table alias name of this relation.
      Specified by:
      as in interface Relation
      Parameters:
      alias - the table alias name.
      Returns:
      the modified relation.
    • alias

      public TableAlias alias()
      Description copied from interface: Relation
      Gets the table alias specified for this relation.
      Specified by:
      alias in interface Relation
      Returns:
      the table alias.