- Type Parameters:
T- the root table type.E- the field type.
- All Implemented Interfaces:
Metamodel<T,,E> Metamodel.Key<T,,E> Navigable<T,E>
Metamodel.Key marker to an existing Metamodel instance.
Equality and hash code are delegated to the wrapped metamodel. Because AbstractMetamodel.equals(java.lang.Object)
checks instanceof Metamodel, a KeyDelegate compares equal to its wrapped metamodel when the
wrapped metamodel is an AbstractMetamodel.
-
Nested Class Summary
Nested classes/interfaces inherited from interface st.orm.Metamodel
Metamodel.Key<T extends Data,E>, Metamodel.KeyDelegate<T extends Data, E> -
Constructor Summary
ConstructorsConstructorDescriptionKeyDelegate(Metamodel<T, E> delegate) Creates an instance of aKeyDelegaterecord class. -
Method Summary
Modifier and TypeMethodDescriptiondelegate()Returns the value of thedelegaterecord component.booleanIndicates whether some other object is "equal to" this one.field()Returns the field name.Returns the field type of the designated element.flatten()Returns a flat list of leaf metamodels for this navigable.@Nullable ObjectExtracts the value from the given record as specified by this metamodel.inthashCode()Returns a hash code value for this object.booleanisColumn()Returnstrueif this navigable corresponds to a database column,falseotherwise (for example the root navigable or an inline record).booleanisIdentical(T a, T b) Checks whether the value extracted fromais identical to the value extracted fromb.booleanisInline()Returnstrueif this navigable corresponds to an inline record,falseotherwise.booleanReturns the nullability of the underlying field.booleanChecks whether the value extracted fromais the same as the value extracted fromb.path()Returns the path to the database table.root()Returns the root table type.table()Returns the table that holds the column to which this metamodel is pointing.toString()Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface st.orm.Navigable
asMetamodel, canonical, fieldPath, tableType
-
Constructor Details
-
KeyDelegate
Creates an instance of aKeyDelegaterecord class.- Parameters:
delegate- the value for thedelegaterecord component
-
-
Method Details
-
isColumn
public boolean isColumn()Description copied from interface:NavigableReturnstrueif this navigable corresponds to a database column,falseotherwise (for example the root navigable or an inline record). A foreign key column is also a column. -
isInline
public boolean isInline()Description copied from interface:NavigableReturnstrueif this navigable corresponds to an inline record,falseotherwise. -
root
Description copied from interface:NavigableReturns the root table type. This is typically the table specified in the FROM clause of a query. -
table
Description copied from interface:MetamodelReturns 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. -
path
Description copied from interface:NavigableReturns the path to the database table. -
fieldType
Description copied from interface:NavigableReturns the field type of the designated element. -
field
Description copied from interface:NavigableReturns the field name. -
getValue
Description copied from interface:MetamodelExtracts the value from the given record as specified by this metamodel.The returned value may be
nullif this metamodel represents a nullable field or if any parent metamodel in the access path resolves tonull(for example, when navigating through an optional or nullable nested record).Implementations may return a non-null value, but callers must not rely on that unless they statically know they are using a non-null metamodel variant.
-
isIdentical
Description copied from interface:MetamodelChecks whether the value extracted fromais identical to the value extracted fromb.Semantics: This method performs an identity comparison on the extracted field value. It returns
trueif and only if both extracted values refer to the same object instance.This operation is only meaningful for reference-typed fields. It is not defined for primitive-typed fields.
Performance guarantees:
- No boxing or unboxing is performed.
- No value coercion or conversion is performed.
- No
equals(...)or comparator logic is used.
- Specified by:
isIdenticalin interfaceMetamodel<T extends Data,E> - Parameters:
a- the instance from which the left-hand value is extracted, must not benull.b- the instance from which the right-hand value is extracted, must not benull.- Returns:
trueif both extracted values are the same object instance.
-
isSame
Description copied from interface:MetamodelChecks whether the value extracted fromais the same as the value extracted fromb.Semantics: This method performs a value comparison on the extracted field value. The comparison is defined by the field type:
- For primitive-typed fields, values are compared using
==. - For reference-typed fields, values are compared using their defined value semantics
(for example
equals(...)or an equivalent comparator).
Performance guarantees:
- No boxing or unboxing is performed.
- No identity comparison is performed.
- The comparison operates directly on the extracted values.
- For primitive-typed fields, values are compared using
-
flatten
Description copied from interface:NavigableReturns 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
groupByandorderBymetamodel 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. -
isNullable
public boolean isNullable()Returns the nullability of the underlying field. A delegate around aMetamodel.Keyanswers through that key; any other delegate derives the answer from the record field the metamodel designates, so a nullable field wrapped byMetamodel.key(Metamodel)is still rejected as a keyset pagination cursor.- Specified by:
isNullablein interfaceMetamodel.Key<T extends Data,E> - Returns:
trueif this key allows duplicate NULLs (nullable withnullsDistinct = true),falseotherwise.- See Also:
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
hashCode
public int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
delegate
Returns the value of thedelegaterecord component.- Returns:
- the value of the
delegaterecord component
-