diff --git a/src/main/java/org/springframework/data/querydsl/ReactiveQuerydslPredicateExecutor.java b/src/main/java/org/springframework/data/querydsl/ReactiveQuerydslPredicateExecutor.java index 697b35043..956c5fca4 100644 --- a/src/main/java/org/springframework/data/querydsl/ReactiveQuerydslPredicateExecutor.java +++ b/src/main/java/org/springframework/data/querydsl/ReactiveQuerydslPredicateExecutor.java @@ -24,66 +24,97 @@ import com.querydsl.core.types.OrderSpecifier; import com.querydsl.core.types.Predicate; /** - * Interface to issue queries using Querydsl {@link Predicate} instances. + * Interface to issue queries using Querydsl {@link Predicate} instances.
+ * Intended for usage along with the {@link org.springframework.data.repository.reactive.ReactiveCrudRepository} + * interface to wire in Querydslsupport. + * + *
+ *     
+ *
+ *  public interface PersonRepository extends ReactiveCrudRepository<Person, String>, ReactiveQuerydslPredicateExecutor<Person> {
+ *             
+ *  }
+ *
+ *  // ...
+ *
+ *  personRepository.findOne(QPerson.person.email.eq("t-800@skynet.io"))
+ *      .flatMap(t800 ->
+ *      //....
+ *
+ *     
+ * 
+ * + * IMPORTANT: Please check the module specific documentation whether or not Querydsl is supported. * * @author Mark Paluch + * @author Christoph Strobl * @since 2.2 */ public interface ReactiveQuerydslPredicateExecutor { /** - * Returns a single entity matching the given {@link Predicate} or {@link Mono#empty()} if none was found. + * Returns a {@link Mono} emitting the entity matching the given {@link Predicate} or {@link Mono#empty()} if none was + * found. * * @param predicate must not be {@literal null}. - * @return a single entity matching the given {@link Predicate} or {@link Mono#empty()} if none was found. + * @return a {@link Mono} emitting a single entity matching the given {@link Predicate} or {@link Mono#empty()} if + * none was found. + * @throws IllegalArgumentException if the required parameter is {@literal null}. * @throws org.springframework.dao.IncorrectResultSizeDataAccessException if the predicate yields more than one * result. */ Mono findOne(Predicate predicate); /** - * Returns all entities matching the given {@link Predicate}. In case no match could be found, {@link Flux} emits no - * items. + * Returns a {@link Flux} emitting all entities matching the given {@link Predicate}. In case no match could be found, + * {@link Flux} emits no items. * * @param predicate must not be {@literal null}. - * @return all entities matching the given {@link Predicate}. + * @return a {@link Flux} emitting all entities matching the given {@link Predicate} one by one. + * @throws IllegalArgumentException if the required parameter is {@literal null}. */ Flux findAll(Predicate predicate); /** - * Returns all entities matching the given {@link Predicate} applying the given {@link Sort}. In case no match could - * be found, {@link Flux} emits no items. + * Returns a {@link Flux} emitting all entities matching the given {@link Predicate} applying the given {@link Sort}. + * In case no match could be found, {@link Flux} emits no items. * * @param predicate must not be {@literal null}. - * @param sort the {@link Sort} specification to sort the results by, may be {@link Sort#empty()}, must not be + * @param sort the {@link Sort} specification to sort the results by, may be {@link Sort#unsorted()}, must not be * {@literal null}. - * @return all entities matching the given {@link Predicate}. + * @return a {@link Flux} emitting all entities matching the given {@link Predicate} one by one. + * @throws IllegalArgumentException if one of the required parameters is {@literal null}. */ Flux findAll(Predicate predicate, Sort sort); /** - * Returns all entities matching the given {@link Predicate} applying the given {@link OrderSpecifier}s. In case no - * match could be found, {@link Flux} emits no items. + * Returns a {@link Flux} emitting all entities matching the given {@link Predicate} applying the given + * {@link OrderSpecifier}s. In case no match could be found, {@link Flux} emits no items. * * @param predicate must not be {@literal null}. * @param orders the {@link OrderSpecifier}s to sort the results by. - * @return all entities matching the given {@link Predicate} applying the given {@link OrderSpecifier}s. + * @return a {@link Flux} emitting all entities matching the given {@link Predicate} applying the given + * {@link OrderSpecifier}s. + * @throws IllegalArgumentException if one of the required parameter is {@literal null}, or contains a {@literal null} + * value. */ Flux findAll(Predicate predicate, OrderSpecifier... orders); /** - * Returns all entities ordered by the given {@link OrderSpecifier}s. + * Returns a {@link Flux} emitting all entities ordered by the given {@link OrderSpecifier}s. * * @param orders the {@link OrderSpecifier}s to sort the results by. - * @return all entities ordered by the given {@link OrderSpecifier}s. + * @return a {@link Flux} emitting all entities ordered by the given {@link OrderSpecifier}s. + * @throws IllegalArgumentException one of the {@link OrderSpecifier OrderSpecifiers} is {@literal null}. */ Flux findAll(OrderSpecifier... orders); /** - * Returns the number of instances matching the given {@link Predicate}. + * Returns a {@link Mono} emitting the number of instances matching the given {@link Predicate}. * * @param predicate the {@link Predicate} to count instances for, must not be {@literal null}. - * @return the number of instances matching the {@link Predicate}. + * @return a {@link Mono} emitting the number of instances matching the {@link Predicate} or {@code 0} if none found. + * @throws IllegalArgumentException if the required parameter is {@literal null}. */ Mono count(Predicate predicate); @@ -91,7 +122,9 @@ public interface ReactiveQuerydslPredicateExecutor { * Checks whether the data store contains elements that match the given {@link Predicate}. * * @param predicate the {@link Predicate} to use for the existence check, must not be {@literal null}. - * @return {@literal true} if the data store contains elements that match the given {@link Predicate}. + * @return a {@link Mono} emitting {@literal true} if the data store contains elements that match the given + * {@link Predicate}, {@literal false} otherwise. + * @throws IllegalArgumentException if the required parameter is {@literal null}. */ Mono exists(Predicate predicate); }