Interface Specification<T>
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
KeysetScrollSpecification
Specification in the sense of Domain Driven Design.
- Author:
- Oliver Gierke, Thomas Darimont, Krzysztof Rzymkowski, Sebastian Staudt, Mark Paluch, Jens Schauder, Daniel Shuy, Sergey Rukin
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Specification<T>
allOf
(Iterable<Specification<T>> specifications) Applies an AND operation to all the givenSpecification
s.static <T> Specification<T>
allOf
(Specification<T>... specifications) default Specification<T>
and
(Specification<T> other) ANDs the givenSpecification
to the current one.static <T> Specification<T>
anyOf
(Iterable<Specification<T>> specifications) Applies an OR operation to all the givenSpecification
s.static <T> Specification<T>
anyOf
(Specification<T>... specifications) static <T> Specification<T>
not
(Specification<T> spec) Negates the givenSpecification
.default Specification<T>
or
(Specification<T> other) ORs the given specification to the current one.jakarta.persistence.criteria.Predicate
toPredicate
(jakarta.persistence.criteria.Root<T> root, jakarta.persistence.criteria.CriteriaQuery<?> query, jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder) Creates a WHERE clause for a query of the referenced entity in form of aPredicate
for the givenRoot
andCriteriaQuery
.static <T> Specification<T>
where
(Specification<T> spec) Simple static factory method to add some syntactic sugar around aSpecification
.
-
Field Details
-
serialVersionUID
static final long serialVersionUID- See Also:
-
-
Method Details
-
not
Negates the givenSpecification
.- Type Parameters:
T
- the type of theRoot
the resulting Specification operates on.- Parameters:
spec
- can be null.- Returns:
- guaranteed to be not null.
- Since:
- 2.0
-
where
Simple static factory method to add some syntactic sugar around aSpecification
.- Type Parameters:
T
- the type of theRoot
the resulting Specification operates on.- Parameters:
spec
- can be null.- Returns:
- guaranteed to be not null.
- Since:
- 2.0
-
and
ANDs the givenSpecification
to the current one.- Parameters:
other
- can be null.- Returns:
- The conjunction of the specifications
- Since:
- 2.0
-
or
ORs the given specification to the current one.- Parameters:
other
- can be null.- Returns:
- The disjunction of the specifications
- Since:
- 2.0
-
toPredicate
@Nullable jakarta.persistence.criteria.Predicate toPredicate(jakarta.persistence.criteria.Root<T> root, jakarta.persistence.criteria.CriteriaQuery<?> query, jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder) Creates a WHERE clause for a query of the referenced entity in form of aPredicate
for the givenRoot
andCriteriaQuery
.- Parameters:
root
- must not be null.query
- must not be null.criteriaBuilder
- must not be null.- Returns:
- a
Predicate
, may be null.
-
allOf
Applies an AND operation to all the givenSpecification
s.- Parameters:
specifications
- TheSpecification
s to compose. Can containnull
s.- Returns:
- The conjunction of the specifications
- Since:
- 3.0
- See Also:
-
allOf
- Since:
- 3.0
- See Also:
-
anyOf
Applies an OR operation to all the givenSpecification
s.- Parameters:
specifications
- TheSpecification
s to compose. Can containnull
s.- Returns:
- The disjunction of the specifications
- Since:
- 3.0
- See Also:
-
anyOf
- Since:
- 3.0
- See Also:
-