- java.lang.Object
-
- org.tentackle.sql.metadata.TableMetaData
-
public class TableMetaData extends java.lang.ObjectMeta data for a table.- Author:
- harald
-
-
Constructor Summary
Constructors Constructor Description TableMetaData(ModelMetaData modelMetaData, java.lang.String modelTableName)Creates a table meta instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)ColumnMetaDatagetColumnByName(java.lang.String columnName)Gets a column by its column name.java.util.Collection<ColumnMetaData>getColumns()Gets the meta data for columns.java.lang.StringgetComment()Gets the comment.java.util.Collection<ForeignKeyMetaData>getForeignKeys()Gets the foreign keys.java.lang.StringgetFullTableName()Gets the database table name with optional schemaname prepended.
Always in lowercase.java.util.Collection<IndexMetaData>getIndexes()Gets the meta data for indexes.ModelMetaDatagetModelMetaData()Gets the model this table belongs to.java.lang.StringgetModelTableName()Gets the table name used in the model.java.lang.StringgetSchemaName()Gets the database schema name.
Always in lowercase.java.lang.StringgetTableName()Gets the database table name.
Always in lowercase.inthashCode()voidsetComment(java.lang.String comment)Sets the comment.voidsetupTableFromMetaData(java.sql.DatabaseMetaData metaData, java.lang.String[] schemas, java.lang.String schemaPattern, java.lang.String tablePattern)Sets up the column from the database meta data result.java.lang.StringtoString()voidvalidate()Validates and postprocesses the table data.
-
-
-
Constructor Detail
-
TableMetaData
public TableMetaData(ModelMetaData modelMetaData, java.lang.String modelTableName)
Creates a table meta instance.- Parameters:
modelMetaData- the model this table belongs tomodelTableName- the tablename used in the model
-
-
Method Detail
-
setupTableFromMetaData
public void setupTableFromMetaData(java.sql.DatabaseMetaData metaData, java.lang.String[] schemas, java.lang.String schemaPattern, java.lang.String tablePattern) throws java.sql.SQLExceptionSets up the column from the database meta data result.- Parameters:
metaData- the database metadataschemas- valid schemas to scan, null if allschemaPattern- the schema (null if none, "" if without schema)tablePattern- the table pattern- Throws:
java.sql.SQLException- the processing failedBackendException- if logical meta data processing error
-
getModelMetaData
public ModelMetaData getModelMetaData()
Gets the model this table belongs to.- Returns:
- the model
-
getModelTableName
public java.lang.String getModelTableName()
Gets the table name used in the model.- Returns:
- the model's tablename
-
getSchemaName
public java.lang.String getSchemaName()
Gets the database schema name.
Always in lowercase.- Returns:
- the schema, null if none
-
getTableName
public java.lang.String getTableName()
Gets the database table name.
Always in lowercase.- Returns:
- the table name (without schema)
-
getFullTableName
public java.lang.String getFullTableName()
Gets the database table name with optional schemaname prepended.
Always in lowercase.- Returns:
- the full table name
-
getComment
public java.lang.String getComment()
Gets the comment.- Returns:
- the comment, null if none
-
setComment
public void setComment(java.lang.String comment)
Sets the comment.- Parameters:
comment- the comment, null if none
-
getColumns
public java.util.Collection<ColumnMetaData> getColumns()
Gets the meta data for columns.- Returns:
- the columns
-
getColumnByName
public ColumnMetaData getColumnByName(java.lang.String columnName)
Gets a column by its column name.- Parameters:
columnName- the column name- Returns:
- the column, null if no such column
-
getIndexes
public java.util.Collection<IndexMetaData> getIndexes()
Gets the meta data for indexes.- Returns:
- the indexes
-
getForeignKeys
public java.util.Collection<ForeignKeyMetaData> getForeignKeys()
Gets the foreign keys.- Returns:
- the foreign keys
-
validate
public void validate()
Validates and postprocesses the table data.
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-