public final class TableMetaData extends Object
The class also has references to the implementation classes which are used for mapping database operations to the
ConditionsObject
and ConditionsObjectCollection
API.
ConditionsObject
,
BaseConditionsObjectCollection
Modifier and Type | Field and Description |
---|---|
private Class<? extends BaseConditionsObjectCollection<?>> |
collectionClass
The collection class.
|
private Set<String> |
fieldNames
The set of field names.
|
private Map<String,Class<?>> |
fieldTypes
The map of field names to their types.
|
private String |
key
The conditions key named (unused???).
|
private Class<? extends ConditionsObject> |
objectClass
The object class.
|
private String |
tableName
The table name.
|
Constructor and Description |
---|
TableMetaData()
Class constructor.
|
TableMetaData(String key,
String tableName,
Class<? extends ConditionsObject> objectClass,
Class<? extends BaseConditionsObjectCollection<?>> collectionClass,
Set<String> fieldNames,
Map<String,Class<?>> fieldTypes)
Fully qualified constructor.
|
Modifier and Type | Method and Description |
---|---|
static List<TableMetaData> |
findByObjectType(List<TableMetaData> tableMetaDataList,
Class<? extends ConditionsObject> objectType)
Find table meta data by object type.
|
Class<? extends ConditionsObjectCollection<?>> |
getCollectionClass()
Get the type of collection this table maps onto.
|
Set<String> |
getFieldNames()
Get the field names.
|
Class<?> |
getFieldType(String fieldName)
Get the type of the field called
fieldName . |
String |
getKey()
Get the key of this conditions type.
|
Class<? extends ConditionsObject> |
getObjectClass()
Get the type of object this table maps onto.
|
String |
getTableName()
Get the name of the table.
|
(package private) ConditionsObjectCollection<?> |
newCollection()
Create a new collection instance from the table meta data's collection type.
|
(package private) ConditionsObject |
newObject()
Create a new object instance from the table meta data's object type.
|
(package private) void |
removeField(String fieldName)
Method for removing a field that was found using the automatic introspection methods.
|
(package private) void |
setFieldNames(String[] fieldNames)
Set all the field names from an array of strings.
|
(package private) void |
setFieldType(String fieldName,
Class<?> fieldType)
Set the type of a field.
|
(package private) void |
setObjectClass(Class<? extends ConditionsObject> objectClass)
Set the class that maps to the database.
|
(package private) void |
setTableName(String tableName)
Set the table name.
|
String |
toString()
Convert to a string.
|
private Class<? extends BaseConditionsObjectCollection<?>> collectionClass
private String key
private Class<? extends ConditionsObject> objectClass
private String tableName
public TableMetaData()
Creates an empty object.
public TableMetaData(String key, String tableName, Class<? extends ConditionsObject> objectClass, Class<? extends BaseConditionsObjectCollection<?>> collectionClass, Set<String> fieldNames, Map<String,Class<?>> fieldTypes)
key
- the conditions keytableName
- the table nameobjectClass
- the object classcollectionClass
- the collection classfieldNames
- the field namesfieldTypes
- the field typespublic static List<TableMetaData> findByObjectType(List<TableMetaData> tableMetaDataList, Class<? extends ConditionsObject> objectType)
tableMetaDataList
- the list of table meta data e.g. from the registryobjectType
- the type of the objectpublic Class<? extends ConditionsObjectCollection<?>> getCollectionClass()
public Set<String> getFieldNames()
public Class<?> getFieldType(String fieldName)
fieldName
.public String getKey()
public Class<? extends ConditionsObject> getObjectClass()
public String getTableName()
ConditionsObjectCollection<?> newCollection() throws ConditionsObjectException
ConditionsObjectException
- if there is an error creating a new collectionConditionsObject newObject() throws ConditionsObjectException
ConditionsObjectException
- if there is an error creating a new objectvoid setFieldNames(String[] fieldNames)
fieldNames
- the names of the fieldsvoid setFieldType(String fieldName, Class<?> fieldType)
fieldName
- the field namefieldType
- the field's type (class)void setObjectClass(Class<? extends ConditionsObject> objectClass)
objectClass
- the class that maps to the databasevoid setTableName(String tableName)
tableName
- the table namepublic String toString()
void removeField(String fieldName)
Copyright © 2019. All rights reserved.