Module storm

Interface Metamodel<T extends Record,E>

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 Type
    Method
    Description
    Returns the component path.
    default String
    Returns the component path.
    Returns the component type of the designated element.
    boolean
    Returns true if the metamodel corresponds to a database column, returns false otherwise, for example if the metamodel refers to the root metamodel or an inline record.
    static <T extends Record, E>
    Metamodel<T,E>
    of(Class<T> table, String path)
    Creates a new metamodel for the given root table and path.
    Returns the path to the database table.
    Returns the root metamodel.
    static <T extends Record>
    Metamodel<T,T>
    root(Class<T> table)
    Creates a new metamodel for the given record type.
    Metamodel<T,? extends Record>
    Returns the table that holds the column to which this metamodel is pointing.
  • Method Details

    • root

      static <T extends Record> Metamodel<T,T> root(@Nonnull Class<T> table)
      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

      static <T extends Record, E> Metamodel<T,E> of(@Nonnull Class<T> table, @Nonnull String path)
      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()
      Returns true if the metamodel corresponds to a database column, returns false otherwise, for example if the metamodel refers to the root metamodel or an inline record.
      Returns:
      true if this metamodel maps to a column, false otherwise.
    • root

      Class<T> root()
      Returns the root metamodel. This is typically the table specified in the FROM clause of a query.
      Returns:
      the root metamodel.
    • table

      Metamodel<T,? extends Record> 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

      Class<E> 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

      default String componentPath()
      Returns the component path.
      Returns:
      component path.