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
FieldsModifier and TypeFieldDescriptionstatic final PredicateSpecification<?>Include all specification. -
Method Summary
Modifier and TypeMethodDescriptiondefault @NonNull PredicateSpecification<T>and(@Nullable PredicateSpecification<T> other) ANDs the givenPredicateSpecificationto the current one.static <T> @NonNull PredicateSpecification<T>not(@Nullable PredicateSpecification<T> spec) Negates the givenPredicateSpecification.default @NonNull PredicateSpecification<T>or(@Nullable PredicateSpecification<T> other) ORs the givenPredicateSpecificationto the current one.@Nullable jakarta.persistence.criteria.PredicatetoPredicate(@NonNull jakarta.persistence.criteria.Root<T> root, @NonNull jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder) Creates a WHERE clause predicate for the given entityRoot.static <T> @NonNull PredicateSpecification<T>where(@Nullable PredicateSpecification<T> spec) Simple static factory method to add some syntactic sugar around aPredicateSpecification.
-
Field Details
-
ALL
Include all specification.
-
-
Method Details
-
where
@NonNull static <T> @NonNull PredicateSpecification<T> where(@Nullable @Nullable PredicateSpecification<T> spec) Simple static factory method to add some syntactic sugar around aPredicateSpecification.- Type Parameters:
T- the type of theRootthe resulting Specification operates on.- Parameters:
spec- The specification.- Returns:
- predicate specification.
-
not
@NonNull static <T> @NonNull PredicateSpecification<T> not(@Nullable @Nullable PredicateSpecification<T> spec) Negates the givenPredicateSpecification.- Type Parameters:
T- the type of theRootthe resulting Specification operates on.- Parameters:
spec- The specification.- Returns:
- negated specification}.
-
and
@NonNull default @NonNull PredicateSpecification<T> and(@Nullable @Nullable PredicateSpecification<T> other) ANDs the givenPredicateSpecificationto the current one.- Parameters:
other- The other predicate.- Returns:
- The conjunction of the specifications
-
or
@NonNull default @NonNull PredicateSpecification<T> or(@Nullable @Nullable PredicateSpecification<T> other) ORs the givenPredicateSpecificationto the current one.- Parameters:
other- The other predicate.- Returns:
- The disjunction of the specifications
-
toPredicate
@Nullable @Nullable jakarta.persistence.criteria.Predicate toPredicate(@NonNull @NonNull jakarta.persistence.criteria.Root<T> root, @NonNull @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
-