Package org.fastnate.generator.context
Class GeneratorTable
java.lang.Object
org.fastnate.generator.context.NamedObject
org.fastnate.generator.context.GeneratorTable
Stores the metadata about existing database tables.
- Author:
- Tobias Liefke
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final StringThe optional name of the catalog that contains this table,nullif the default catalog is used.private final Map<String, GeneratorColumn> The known columns for this table.private final GeneratorContextThe current generator context.private final intThe index of this table in the list of all available tables.private final StringThe name of this table.private final StringThe fully qualified name of this table, as used by the dialect.private final StringThe optional name of the schema that contains this table,nullif the default schema is used. -
Constructor Summary
ConstructorsConstructorDescriptionGeneratorTable(int index, String catalog, String schema, String name, String qualifiedName, GeneratorContext context) Creates a newGeneratorTableinstance. -
Method Summary
Modifier and TypeMethodDescriptionThe optional name of the catalog that contains this table,nullif the default catalog is used.The known columns for this table.The current generator context.intgetIndex()The index of this table in the list of all available tables.getName()The name of this table.The fully qualified name of this table, as used by the dialect.The optional name of the schema that contains this table,nullif the default schema is used.Removes any quotes from the catalog name.Removes any quotes from the schema name.resolveColumn(String columnName) Adds or finds a column which is part of an insert statement to this statement.resolveColumn(String columnName, boolean autoGenerated) Adds or finds a column which is part of this table.Methods inherited from class org.fastnate.generator.context.NamedObject
getUnquotedName, toString, unqoteObjectName
-
Field Details
-
index
private final int indexThe index of this table in the list of all available tables. -
catalog
The optional name of the catalog that contains this table,nullif the default catalog is used. -
schema
The optional name of the schema that contains this table,nullif 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. -
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 newGeneratorTableinstance.- 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,nullif the default catalog is used.schema- The optional name of the schema that contains this table,nullif 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
Removes any quotes from the catalog name.- Returns:
- the schema name without quotes or
nullif no catalog name exists
-
getUnquotedSchema
Removes any quotes from the schema name.- Returns:
- the schema name without quotes or
nullif no schema name exists
-
resolveColumn
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
Adds or finds a column which is part of this table.- Parameters:
columnName- the name of the new columnautoGenerated-trueif 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
The optional name of the catalog that contains this table,nullif the default catalog is used. -
getSchema
The optional name of the schema that contains this table,nullif the default schema is used. -
getName
The name of this table.- Specified by:
getNamein classNamedObject- Returns:
- the name of the object, possibly quoted with '"' or '`'
-
getQualifiedName
The fully qualified name of this table, as used by the dialect.- Specified by:
getQualifiedNamein classNamedObject- Returns:
- the name of the object, quoted according to the dialect
-
getContext
The current generator context. -
getColumns
The known columns for this table.
-