Package jakarta.data.model
Class Attribute
java.lang.Object
jakarta.data.model.Attribute
Represents an entity attribute in the
StaticMetamodel
.-
Method Summary
Modifier and TypeMethodDescriptionfinal Sort
asc()
Obtain a request for an ascendingSort
based on the entity attribute.final Sort
Obtain a request for an ascending, case insensitiveSort
based on the entity attribute.final Sort
desc()
Obtain a request for a descendingSort
based on the entity attribute.final Sort
Obtain a request for a descending, case insensitiveSort
based on the entity attribute.static final Attribute
get()
Obtains a new instance for the Jakarta Data provider to initialize.final boolean
init
(AttributeInfo attrInfo) Used by the Jakarta Data provider to initialize thisAttribute
with implementation.final String
name()
Obtain the entity attribute name, suitable for use wherever the specification requires an entity attribute name.
-
Method Details
-
asc
Obtain a request for an ascendingSort
based on the entity attribute.- Returns:
- a request for an ascending sort on the entity attribute.
- Throws:
MappingException
- if an entity attribute with this name does not exist or if no Jakarta Data provider provides a repository for the entity type.
-
ascIgnoreCase
Obtain a request for an ascending, case insensitiveSort
based on the entity attribute.- Returns:
- a request for an ascending, case insensitive sort on the entity attribute.
- Throws:
MappingException
- if an entity attribute with this name does not exist or if no Jakarta Data provider provides a repository for the entity type.
-
desc
Obtain a request for a descendingSort
based on the entity attribute.- Returns:
- a request for a descending sort on the entity attribute.
- Throws:
MappingException
- if an entity attribute with this name does not exist or if no Jakarta Data provider provides a repository for the entity type.
-
descIgnoreCase
Obtain a request for a descending, case insensitiveSort
based on the entity attribute.- Returns:
- a request for a descending, case insensitive sort on the entity attribute.
- Throws:
MappingException
- if an entity attribute with this name does not exist or if no Jakarta Data provider provides a repository for the entity type.
-
get
Obtains a new instance for the Jakarta Data provider to initialize.
The Jakarta Data provider automatically initializes the instance when used as the value of a
public
,static
,final
field of a class that is annotated withStaticMetamodel
, where the field name matches the name of an entity attribute. For example, aVehicle
entity with attributesvin
,make
,model
, andyear
could have the following static metamodel,@StaticMetamodel(Vehicle.class) public class Vehicle_ { public static final Attribute vin = Attribute.get(); public static final Attribute make = Attribute.get(); public static final Attribute model = Attribute.get(); public static final Attribute year = Attribute.get(); }
- Returns:
- a new instance for an entity attribute.
-
init
Used by the Jakarta Data provider to initialize thisAttribute
with implementation.- Parameters:
attrInfo
- attribute information provided by the Jakarta Data provider.- Returns:
- true if initialization was successful; false if previously initialized.
-
name
Obtain the entity attribute name, suitable for use wherever the specification requires an entity attribute name. For example, as the parameter toSort.asc(String)
.- Returns:
- the entity attribute name.
- Throws:
MappingException
- if an entity attribute with this name does not exist or if no Jakarta Data provider provides a repository for the entity type.
-