Class TableInfo
java.lang.Object
onl.ycode.stormify.TableInfo
Metadata container for a database table, holding the class-to-table mapping,
field information, and primary key definitions.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanCheck the consistency of the table.Class<?> Get the class type of the table.getDbField(String name) Get a reference of the field, given a specific database column name.Get a reference of the field, given a specific field name.Get all the fields of the table.Get the primary key of the table.Get a list of all primary keys of the table.Get the name of the table.toString()
-
Method Details
-
getClassType
Get the class type of the table.- Returns:
- The class type of the table.
-
getTableName
-
getPrimaryKeys
-
getPrimaryKey
Get the primary key of the table. If the table has more than one primary key, or no primary key, then an exception is thrown.- Returns:
- The primary key of the table.
-
getFields
Get all the fields of the table.- Returns:
- The fields of the table.
-
getDbField
Get a reference of the field, given a specific database column name.Note that there may be more than one FieldInfo, to support cases where the same column is used in multiple fields. One such common scenario is when a foreign key is used both as a reference and as a numeric id value.
- Parameters:
name- The name of the column in the database.- Returns:
- The fields corresponding to the specific column name.
-
getField
-
toString
-
checkConsistency
public boolean checkConsistency()Check the consistency of the table. For every database column, there should be at most one field that is updatable and at most one field that is creatable. If there are more than one fields, then the table is considered inconsistent.- Returns:
- True if the table is consistent, false otherwise.
-