- Type Parameters:
T- the root table type.E- the field type.
- All Implemented Interfaces:
Metamodel<T,,E> Metamodel.Key<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 metamodel.Extracts the value from the given record as specified by this metamodel.inthashCode()Returns a hash code value for this object.booleanisColumn()Returnstrueif the metamodel corresponds to a database column, returnsfalseotherwise, for example, if the metamodel refers to the root metamodel or an inline record.booleanisIdentical(T a, T b) Checks whether the value extracted fromais identical to the value extracted fromb.booleanisInline()Returnstrueif the metamodel corresponds to an inline record, returnsfalseotherwise.booleanReturnstrueif this key field allows NULL values with standard SQL distinct-NULL semantics, meaning the UNIQUE constraint does not prevent multiple NULLs.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 metamodel.table()Returns the table that holds the column to which this metamodel is pointing.toString()Returns a string representation of this record class.
-
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:MetamodelReturnstrueif the metamodel corresponds to a database column, returnsfalseotherwise, 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.
-
isInline
public boolean isInline()Description copied from interface:MetamodelReturnstrueif the metamodel corresponds to an inline record, returnsfalseotherwise. -
root
Description copied from interface:MetamodelReturns the root metamodel. 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:MetamodelReturns the path to the database table. -
fieldType
Description copied from interface:MetamodelReturns the field type of the designated element. -
field
Description copied from interface:MetamodelReturns 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:MetamodelReturns a flat list of leaf metamodels for this metamodel. If this metamodel is not an inline record, it returns a singleton list containingthis. If it is an inline record, it recursively expands all nested inline records and returns the individual column metamodels.This method is useful for operations like ORDER BY and GROUP BY, where inline records need to be expanded into their individual columns.
-
isNullable
public boolean isNullable()Description copied from interface:Metamodel.KeyReturnstrueif this key field allows NULL values with standard SQL distinct-NULL semantics, meaning the UNIQUE constraint does not prevent multiple NULLs.A nullable key is unsafe for keyset pagination because
WHERE key > cursorsilently excludes NULL rows. Thescrollmethods check this flag and throw aPersistenceExceptionif the key is nullable.- 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
-