Class GeneratorTable

java.lang.Object
org.fastnate.generator.context.NamedObject
org.fastnate.generator.context.GeneratorTable

public class GeneratorTable extends NamedObject
Stores the metadata about existing database tables.
Author:
Tobias Liefke
  • Field Details

    • index

      private final int index
      The index of this table in the list of all available tables.
    • catalog

      private final String catalog
      The optional name of the catalog that contains this table, null if the default catalog is used.
    • schema

      private final String schema
      The optional name of the schema that contains this table, null if the default schema is used.
    • name

      private final String name
      The name of this table.
    • qualifiedName

      private final String qualifiedName
      The fully qualified name of this table, as used by the dialect.
    • context

      private final GeneratorContext context
      The current generator context.
    • columns

      private final Map<String,GeneratorColumn> columns
      The known columns for this table.
  • Constructor Details

    • GeneratorTable

      public GeneratorTable(int index, String catalog, String schema, String name, String qualifiedName, GeneratorContext context)
      Creates a new GeneratorTable instance.
      Parameters:
      index - The index of this table in the list of all available tables.
      catalog - The optional name of the catalog that contains this table, null if the default catalog is used.
      schema - The optional name of the schema that contains this table, null if the default schema is used.
      name - The name of this table.
      qualifiedName - The fully qualified name of this table, as used by the dialect.
      context - The current generator context.
  • Method Details

    • getUnquotedCatalog

      public String getUnquotedCatalog()
      Removes any quotes from the catalog name.
      Returns:
      the schema name without quotes or null if no catalog name exists
    • getUnquotedSchema

      public String getUnquotedSchema()
      Removes any quotes from the schema name.
      Returns:
      the schema name without quotes or null if no schema name exists
    • resolveColumn

      public GeneratorColumn resolveColumn(String columnName)
      Adds or finds a column which is part of an insert statement to this statement.
      Parameters:
      columnName - the name of the new column
      Returns:
      the found resp. created column
    • resolveColumn

      public GeneratorColumn resolveColumn(String columnName, boolean autoGenerated)
      Adds or finds a column which is part of this table.
      Parameters:
      columnName - the name of the new column
      autoGenerated - true if this column is not part of any insert statement, because it is generated by the database
      Returns:
      the found resp. created column
    • getIndex

      public int getIndex()
      The index of this table in the list of all available tables.
    • getCatalog

      public String getCatalog()
      The optional name of the catalog that contains this table, null if the default catalog is used.
    • getSchema

      public String getSchema()
      The optional name of the schema that contains this table, null if the default schema is used.
    • getName

      public String getName()
      The name of this table.
      Specified by:
      getName in class NamedObject
      Returns:
      the name of the object, possibly quoted with '"' or '`'
    • getQualifiedName

      public String getQualifiedName()
      The fully qualified name of this table, as used by the dialect.
      Specified by:
      getQualifiedName in class NamedObject
      Returns:
      the name of the object, quoted according to the dialect
    • getContext

      public GeneratorContext getContext()
      The current generator context.
    • getColumns

      public Map<String,GeneratorColumn> getColumns()
      The known columns for this table.