Interface QuerySpecification<T>
-
- Type Parameters:
T- The entity root type
public interface QuerySpecification<T>Criteria query specification. Based on Spring Data'sSpecification.- Since:
- 3.2
- Author:
- Denis Stepanov
-
-
Field Summary
Fields Modifier and Type Field Description static QuerySpecification<?>ALLInclude all specification.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default QuerySpecification<T>and(PredicateSpecification<T> other)ANDs the givenPredicateSpecificationto the current one.default QuerySpecification<T>and(QuerySpecification<T> other)ANDs the givenQuerySpecificationto the current one.static <T> QuerySpecification<T>not(QuerySpecification<T> spec)Negates the givenQuerySpecification.default QuerySpecification<T>or(PredicateSpecification<T> other)ORs the givenPredicateSpecificationto the current one.default QuerySpecification<T>or(QuerySpecification<T> other)ORs the given specification to the current one.jakarta.persistence.criteria.PredicatetoPredicate(jakarta.persistence.criteria.Root<T> root, jakarta.persistence.criteria.CriteriaQuery<?> query, jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder)Creates a WHERE clause predicate for the given entityRootand a criteria query.static <T> QuerySpecification<T>where(PredicateSpecification<T> spec)Simple static factory method to add some syntactic sugar around aPredicateSpecification.static <T> QuerySpecification<T>where(QuerySpecification<T> spec)Simple static factory method to add some syntactic sugar around aQuerySpecification.
-
-
-
Field Detail
-
ALL
static final QuerySpecification<?> ALL
Include all specification.
-
-
Method Detail
-
not
@NonNull static <T> QuerySpecification<T> not(@Nullable QuerySpecification<T> spec)
Negates the givenQuerySpecification.- Type Parameters:
T- the type of theRootthe resulting Specification operates on.- Parameters:
spec- The specification.- Returns:
- negated specification}.
-
where
@NonNull static <T> QuerySpecification<T> where(@Nullable QuerySpecification<T> spec)
Simple static factory method to add some syntactic sugar around aQuerySpecification.- Type Parameters:
T- the type of theRootthe resulting Specification operates on.- Parameters:
spec- The specification.- Returns:
- guaranteed to be not null.
-
where
@NonNull static <T> QuerySpecification<T> where(@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:
- query specification.
-
and
@NonNull default QuerySpecification<T> and(@Nullable QuerySpecification<T> other)
ANDs the givenQuerySpecificationto the current one.- Parameters:
other- The other predicate.- Returns:
- The conjunction of the specifications
-
or
@NonNull default QuerySpecification<T> or(@Nullable QuerySpecification<T> other)
ORs the given specification to the current one.- Parameters:
other- The other predicate.- Returns:
- The disjunction of the specifications
-
and
@NonNull default QuerySpecification<T> and(@Nullable PredicateSpecification<T> other)
ANDs the givenPredicateSpecificationto the current one.- Parameters:
other- The other predicate.- Returns:
- The conjunction of the specifications
-
or
@NonNull default QuerySpecification<T> or(@Nullable PredicateSpecification<T> other)
ORs the givenPredicateSpecificationto 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.CriteriaQuery<?> query, @NonNull jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder)Creates a WHERE clause predicate for the given entityRootand a criteria query.- Parameters:
root- The entity rootquery- The criteria querycriteriaBuilder- The criteria builder- Returns:
- a
Predicate
-
-