Package st.orm

Interface Navigable<T extends Data,E>

Type Parameters:
T - the root table type (the entity from which the path originates).
E - the field type of the designated element.
All Known Subinterfaces:
Metamodel<T,E>, Metamodel.Key<T,E>, TypedMetamodel<T,E,V>
All Known Implementing Classes:
AbstractKeyMetamodel, AbstractMetamodel, AbstractNavigableMetamodel, Metamodel.KeyDelegate

public interface Navigable<T extends Data,E>
The navigational part of a Metamodel: everything needed to locate a field within the entity graph and use it in a query (filter, join, order, group, select), without exposing value extraction.

Metamodel extends Navigable and adds the value-based operations (getValue, isSame, isIdentical). Splitting these apart lets a path navigate beyond a Ref foreign key: the referenced entity is not loaded, so such a path is Navigable (queryable) but not a full Metamodel (not value-extractable). Query methods that only need to locate a column accept Navigable; methods that read a value from a record (for example getResultGroupedBy) require a TypedMetamodel, so applying them to a reference-crossing path fails to compile rather than at runtime.

Since:
1.13
  • Method Summary

    Modifier and Type
    Method
    Description
    default Metamodel<T,E>
    Returns this navigable as a metamodel that can locate a column.
    default Metamodel<? extends Data,E>
    Returns the canonical metamodel for the field represented by this.
    Returns the field name.
    default String
    Returns the field path.
    Returns the field type of the designated element.
    default List<Metamodel<T,?>>
    Returns a flat list of leaf metamodels for this navigable.
    boolean
    Returns true if this navigable corresponds to a database column, false otherwise (for example the root navigable or an inline record).
    boolean
    Returns true if this navigable corresponds to an inline record, false otherwise.
    Returns the path to the database table.
    Returns the root table type.
    Navigable<T,? extends Data>
    Returns the navigable of the table that holds the column this navigable points to.
    default Class<? extends Data>
    Returns the type of the table that holds the column this navigable points to.
  • Method Details

    • canonical

      default Metamodel<? extends Data,E> canonical()
      Returns the canonical metamodel for the field represented by this. The result captures only the table type and field, independent of position within a table graph, which makes it suitable for equality checks and column resolution.
      Returns:
      the canonical metamodel for this navigable.
    • isColumn

      boolean isColumn()
      Returns true if this navigable corresponds to a database column, false otherwise (for example the root navigable or an inline record). A foreign key column is also a column.
      Returns:
      true if this navigable maps to a column, false otherwise.
    • isInline

      boolean isInline()
      Returns true if this navigable corresponds to an inline record, false otherwise.
      Returns:
      true if this navigable maps to an inline record, false otherwise.
    • root

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

      Navigable<T,? extends Data> table()
      Returns the navigable of the table that holds the column this navigable points to. For an inline record the table is the parent table; for the root navigable the root table is returned.
      Returns:
      the navigable of the table that holds the column this navigable points to.
    • tableType

      default Class<? extends Data> tableType()
      Returns the type of the table that holds the column this navigable points to.
      Returns:
      the type of the table that holds the column this navigable points to.
    • path

      String path()
      Returns the path to the database table.
      Returns:
      path to the database table.
    • fieldType

      Class<E> fieldType()
      Returns the field type of the designated element.
      Returns:
      the field type of the designated element.
    • field

      String field()
      Returns the field name.
      Returns:
      field name.
    • fieldPath

      default String fieldPath()
      Returns the field path.
      Returns:
      field path.
    • flatten

      default List<Metamodel<T,?>> flatten()
      Returns a flat list of leaf metamodels for this navigable. An inline record is recursively expanded into its individual column metamodels; any other navigable returns a singleton list, because it names its own column(s): an entity node names the foreign key column(s) that reference it, and a scalar names its column. The returned metamodels keep their position in the graph, so they are not canonical.

      The query builder's groupBy and orderBy metamodel overloads do not use this expansion: they resolve a path to the same columns a predicate on that path would use, so a multi-column path (a compound foreign key, an inline record) expands during column resolution rather than here.

      Returns:
      a list of leaf metamodels.
    • asMetamodel

      default Metamodel<T,E> asMetamodel()
      Returns this navigable as a metamodel that can locate a column. A full metamodel is returned as-is; a navigation-only node (one that navigates beyond a Ref) is rebuilt into a resolvable metamodel for its path, so it can name a column in WHERE, ORDER BY, GROUP BY and HAVING.

      A rebuilt metamodel is query-only: it names a column but cannot extract a value from a record, which is why value operations keep taking Metamodel rather than Navigable.

      Returns:
      this navigable as a metamodel.
      Since:
      1.13