Package st.orm

Class AbstractMetamodel<T extends Data,E,V>

java.lang.Object
st.orm.AbstractMetamodel<T,E,V>
Type Parameters:
T - the primary table type.
E - the field type of the designated element.
V - the value type of the designated element.
All Implemented Interfaces:
Metamodel<T,E>
Direct Known Subclasses:
AbstractKeyMetamodel

public abstract class AbstractMetamodel<T extends Data,E,V> extends Object implements Metamodel<T,E>
Implementation that is used by the generated models.
Since:
1.2
  • Constructor Details

    • AbstractMetamodel

      public AbstractMetamodel(@Nonnull Class<E> fieldType)
    • AbstractMetamodel

      public AbstractMetamodel(@Nonnull Class<E> fieldType, @Nonnull String path)
    • AbstractMetamodel

      public AbstractMetamodel(@Nonnull Class<E> fieldType, @Nonnull String path, @Nonnull String field, boolean inline, @Nullable Metamodel<T,?> parent)
    • AbstractMetamodel

      protected AbstractMetamodel(@Nonnull Class<E> fieldType, @Nonnull String path, @Nonnull String field, boolean inline, @Nullable Metamodel<T,?> parent, boolean isColumn)
  • Method Details

    • equals

      public final boolean equals(Object o)
      Equality is based on fieldType() of table() and field().
      Overrides:
      equals in class Object
    • hashCode

      public final int hashCode()
      Hash code is based on fieldType() of table() and field().
      Overrides:
      hashCode in class Object
    • isColumn

      public 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.

      Note that a column can also be a table, for example, in the case of a foreign key.

      Specified by:
      isColumn in interface Metamodel<T extends Data,E>
      Returns:
      true if this metamodel maps to a column, false otherwise.
    • root

      public Class<T> root()
      Returns the root metamodel. This is typically the table specified in the FROM clause of a query.
      Specified by:
      root in interface Metamodel<T extends Data,E>
      Returns:
      the root metamodel.
    • table

      public Metamodel<T,? extends Data> 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.
      Specified by:
      table in interface Metamodel<T extends Data,E>
      Returns:
      the table that holds the column to which this metamodel is pointing.
    • isInline

      public boolean isInline()
      Returns true if the metamodel corresponds to an inline record, returns false otherwise.
      Specified by:
      isInline in interface Metamodel<T extends Data,E>
      Returns:
      true if this metamodel maps to an inline record, false otherwise.
    • fieldType

      public Class<E> fieldType()
      Returns the field type of the designated element.
      Specified by:
      fieldType in interface Metamodel<T extends Data,E>
      Returns:
      the field type of the designated element.
    • path

      public String path()
      Returns the path to the database table.
      Specified by:
      path in interface Metamodel<T extends Data,E>
      Returns:
      path to the database table.
    • field

      public String field()
      Returns the field name.
      Specified by:
      field in interface Metamodel<T extends Data,E>
      Returns:
      field name.
    • toString

      public String toString()
      Overrides:
      toString in class Object