Interface PredicateSpecification<T>
-
- Type Parameters:
T
- The entity root type
public interface PredicateSpecification<T>
The predicate specification.- Since:
- 3.2
- Author:
- Denis Stepanov
-
-
Field Summary
Fields Modifier and Type Field Description static PredicateSpecification<?>
ALL
Include all specification.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default PredicateSpecification<T>
and(PredicateSpecification<T> other)
ANDs the givenPredicateSpecification
to the current one.static <T> PredicateSpecification<T>
not(PredicateSpecification<T> spec)
Negates the givenPredicateSpecification
.default PredicateSpecification<T>
or(PredicateSpecification<T> other)
ORs the givenPredicateSpecification
to the current one.jakarta.persistence.criteria.Predicate
toPredicate(jakarta.persistence.criteria.Root<T> root, jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder)
Creates a WHERE clause predicate for the given entityRoot
.static <T> PredicateSpecification<T>
where(PredicateSpecification<T> spec)
Simple static factory method to add some syntactic sugar around aPredicateSpecification
.
-
-
-
Field Detail
-
ALL
static final PredicateSpecification<?> ALL
Include all specification.
-
-
Method Detail
-
where
@NonNull static <T> PredicateSpecification<T> where(@Nullable PredicateSpecification<T> spec)
Simple static factory method to add some syntactic sugar around aPredicateSpecification
.- Type Parameters:
T
- the type of theRoot
the resulting Specification operates on.- Parameters:
spec
- The specification.- Returns:
- predicate specification.
-
not
@NonNull static <T> PredicateSpecification<T> not(@Nullable PredicateSpecification<T> spec)
Negates the givenPredicateSpecification
.- Type Parameters:
T
- the type of theRoot
the resulting Specification operates on.- Parameters:
spec
- The specification.- Returns:
- negated specification}.
-
and
@NonNull default PredicateSpecification<T> and(@Nullable PredicateSpecification<T> other)
ANDs the givenPredicateSpecification
to the current one.- Parameters:
other
- The other predicate.- Returns:
- The conjunction of the specifications
-
or
@NonNull default PredicateSpecification<T> or(@Nullable PredicateSpecification<T> other)
ORs the givenPredicateSpecification
to the current one.- Parameters:
other
- The other predicate.- Returns:
- The disjunction of the specifications
-
toPredicate
@Nullable jakarta.persistence.criteria.Predicate toPredicate(@NonNull jakarta.persistence.criteria.Root<T> root, @NonNull jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder)
Creates a WHERE clause predicate for the given entityRoot
.- Parameters:
root
- The entity root.criteriaBuilder
- The criteria builder.- Returns:
- a
Predicate
-
-