T
- The class that the code will be operating on.ID
- The class of the ID column associated with the class. The T class does not require an ID field. The class
needs an ID parameter however so you can use Void or Object to satisfy the compiler.public class TableInfo<T,ID> extends Object
Constructor and Description |
---|
TableInfo(DatabaseType databaseType,
Class<T> dataClass)
Creates a holder of information about a table/class.
|
TableInfo(DatabaseType databaseType,
DatabaseTableConfig<T> tableConfig)
Creates a holder of information about a table/class.
|
Modifier and Type | Method and Description |
---|---|
Class<T> |
getDataClass()
Return the class associated with this object-info.
|
FieldType |
getFieldTypeByColumnName(String columnName)
Return the
FieldType associated with the columnName. |
FieldType[] |
getFieldTypes()
Return the array of field types associated with the object.
|
FieldType[] |
getForeignCollections()
Return an array with the fields that are
ForeignCollection s or a blank array if none. |
FieldType |
getIdField()
Return the id-field associated with the object.
|
String |
getSchemaName()
Return the name of the schema or null if none.
|
String |
getTableName()
Return the name of the table associated with the object.
|
boolean |
hasColumnName(String columnName)
Return true if this table information has a field with this columnName as set by
DatabaseField.columnName() or the field name if not set. |
boolean |
isForeignAutoCreate()
Return true if one of the fields has
DatabaseField.foreignAutoCreate() enabled. |
boolean |
isUpdatable()
Return true if we can update this object via its ID.
|
String |
objectToString(T object)
Return a string representation of the object.
|
public TableInfo(DatabaseType databaseType, Class<T> dataClass) throws SQLException
databaseType
- Database type we are storing the class in.dataClass
- Class that we are holding information about.SQLException
public TableInfo(DatabaseType databaseType, DatabaseTableConfig<T> tableConfig) throws SQLException
databaseType
- Database type we are storing the class in.tableConfig
- Configuration for our table.SQLException
public String getTableName()
public String getSchemaName()
public FieldType[] getFieldTypes()
public FieldType getFieldTypeByColumnName(String columnName)
FieldType
associated with the columnName.public FieldType getIdField()
public boolean isUpdatable()
public boolean isForeignAutoCreate()
DatabaseField.foreignAutoCreate()
enabled.public FieldType[] getForeignCollections()
ForeignCollection
s or a blank array if none.public boolean hasColumnName(String columnName)
DatabaseField.columnName()
or the field name if not set.This documentation is licensed by Gray Watson under the Creative Commons Attribution-Share Alike 3.0 License.