Module jakarta.data
Package jakarta.data.metamodel
Interface ComparableAttribute<T,V extends Comparable<?>>
- Type Parameters:
T- entity class of the static metamodel.V- type of entity attribute (or wrapper type if primitive).
- All Superinterfaces:
Attribute<T>,BasicAttribute<T,,V> ComparableExpression<T,,V> Expression<T,,V> SortableAttribute<T>
- All Known Subinterfaces:
BooleanAttribute<T>,NumericAttribute<T,,N> TemporalAttribute<T,,V> TextAttribute<T>
- All Known Implementing Classes:
TextAttributeRecord
public interface ComparableAttribute<T,V extends Comparable<?>>
extends BasicAttribute<T,V>, SortableAttribute<T>, ComparableExpression<T,V>
Represents a comparable entity attribute in the StaticMetamodel.
Comparable entity attributes can be sorted on in query results and can be
compared against values in query restrictions.
Where possible, always use the more specific subtypes of
ComparableAttribute:
TextAttributefor entity attributes that represent text, typically of typeString.NumericAttributefor entity attributes that represent numeric values, such aslong,Float, andBigInteger.BooleanAttributefor entity attributes that representtrueorfalsevalues of typebooleanorBoolean.TemporalAttributefor entity attributes that represent temporal values, such asLocalDateandInstant.
Entity attribute types for which ComparableAttribute is appropriate
include:
- character attributes:
charandCharacter - enum attributes - Note that it is provider-specific whether order is
based on
Enum.ordinal()orEnum.name(). The Jakarta Persistence default ofordinalcan be overridden with thejakarta.persistence.Enumeratedannotation. UUIDattributes
In the above cases, ComparableAttribute, which provides more
function, is preferred over SortableAttribute.
- Since:
- 1.1
-
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic <T,V extends Comparable<?>>
ComparableAttribute<T, V> Creates a static metamodelComparableAttributerepresenting the entity attribute with the specified name.Methods inherited from interface jakarta.data.metamodel.Attribute
declaringType, nameMethods inherited from interface jakarta.data.metamodel.BasicAttribute
typeMethods inherited from interface jakarta.data.expression.ComparableExpression
between, between, greaterThan, greaterThan, greaterThanEqual, greaterThanEqual, lessThan, lessThan, lessThanEqual, lessThanEqual, notBetween, notBetweenMethods inherited from interface jakarta.data.expression.Expression
equalTo, equalTo, in, in, in, isNull, notEqualTo, notEqualTo, notIn, notIn, notIn, notNull, satisfies, typeMethods inherited from interface jakarta.data.metamodel.SortableAttribute
asc, desc
-
Method Details
-
of
static <T,V extends Comparable<?>> ComparableAttribute<T,V> of(Class<T> entityClass, String name, Class<V> attributeType) Creates a static metamodel
ComparableAttributerepresenting the entity attribute with the specified name.- Type Parameters:
T- entity class of the static metamodel.V- type of entity attribute (or wrapper type if primitive).- Parameters:
entityClass- the entity class.name- the name of the entity attribute.attributeType- type of the entity attribute.- Returns:
- instance of
ComparableAttribute.
-