Package st.orm

Class AbstractMetamodel<T extends Data,E,V extends @Nullable Object>

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>, Navigable<T,E>, TypedMetamodel<T,E,V>
Direct Known Subclasses:
AbstractKeyMetamodel

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

    • AbstractMetamodel

      public AbstractMetamodel(Class<E> fieldType)
    • AbstractMetamodel

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

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

      protected AbstractMetamodel(Class<E> fieldType, String path, 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(), path() and field().
      Overrides:
      equals in class Object
    • hashCode

      public final int hashCode()
      Hash code is based on fieldType() of table(), path() and field().

      The hash is cached: metamodel instances are immutable and are hashed on every compilation-key lookup. The benign race follows the String.hashCode() pattern, recomputing only when the hash happens to be zero.

      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 Navigable<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 Navigable<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>
      Specified by:
      table in interface Navigable<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 Navigable<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 Navigable<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 Navigable<T extends Data,E>
      Returns:
      path to the database table.
    • field

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

      public String toString()
      Overrides:
      toString in class Object