- Type Parameters:
T- the primary table type.E- the record component type of the designated element.
- All Known Implementing Classes:
MetamodelImpl
public interface Metamodel<T extends Record,E>
The metamodel is used to map database columns to the object model in a type-safe way.
- Since:
- 1.2
-
Method Summary
Modifier and TypeMethodDescriptionReturns the component path.default StringReturns the component path.Returns the component type of the designated element.booleanisColumn()Returnstrueif the metamodel corresponds to a database column, returnsfalseotherwise, for example if the metamodel refers to the root metamodel or an inline record.Creates a new metamodel for the given root table and path.path()Returns the path to the database table.root()Returns the root metamodel.Creates a new metamodel for the given record type.table()Returns the table that holds the column to which this metamodel is pointing.
-
Method Details
-
root
Creates a new metamodel for the given record type.- Type Parameters:
T- the root table type.- Parameters:
table- the root table to create the metamodel for.- Returns:
- a new metamodel for the given record type.
-
of
Creates a new metamodel for the given root table and path.This method is typically used to manually create a metamodel for a component of a record, which can be useful in cases where the metamodel cannot be generated automatically, for example, local records.
- Type Parameters:
T- the root table type.E- the record component type of the designated component.- Parameters:
table- the root table to create the metamodel for.path- a dot separated path starting from the root table.- Returns:
- a new metamodel for the given root table and path.
- Throws:
PersistenceException- if the metamodel cannot be created for the root table and path.
-
isColumn
boolean isColumn()Returnstrueif the metamodel corresponds to a database column, returnsfalseotherwise, for example if the metamodel refers to the root metamodel or an inline record.- Returns:
trueif this metamodel maps to a column,falseotherwise.
-
root
Returns the root metamodel. This is typically the table specified in the FROM clause of a query.- Returns:
- the root metamodel.
-
table
Returns the table that holds the column to which this metamodel is pointing. If the metamodel points to an inline record, the table is the parent table of the inline record. If the metamodel is a root metamodel, the root table is returned.- Returns:
- the table that holds the column to which this metamodel is pointing.
-
path
String path()Returns the path to the database table.- Returns:
- path to the database table.
-
componentType
Returns the component type of the designated element.- Returns:
- the component type of the designated element.
-
component
String component()Returns the component path.- Returns:
- component path.
-
componentPath
Returns the component path.- Returns:
- component path.
-