Browse Source

DATACMNS-995 - Polishing.

Update JavaDoc to reflect reactive types, not null arguments and potential exceptions.
Align not null JavaDoc of imperative QueryByExample interface.

Original Pull Request: #197
pull/219/head
Christoph Strobl 9 years ago
parent
commit
77be0ba859
  1. 12
      src/main/java/org/springframework/data/repository/query/QueryByExampleExecutor.java
  2. 23
      src/main/java/org/springframework/data/repository/query/ReactiveQueryByExampleExecutor.java

12
src/main/java/org/springframework/data/repository/query/QueryByExampleExecutor.java

@ -35,7 +35,7 @@ public interface QueryByExampleExecutor<T> { @@ -35,7 +35,7 @@ public interface QueryByExampleExecutor<T> {
/**
* Returns a single entity matching the given {@link Example} or {@literal null} if none was found.
*
* @param example can be {@literal null}.
* @param example must not be {@literal null}.
* @return a single entity matching the given {@link Example} or {@link Optional#empty()} if none was found.
* @throws org.springframework.dao.IncorrectResultSizeDataAccessException if the Example yields more than one result.
*/
@ -45,7 +45,7 @@ public interface QueryByExampleExecutor<T> { @@ -45,7 +45,7 @@ public interface QueryByExampleExecutor<T> {
* Returns all entities matching the given {@link Example}. In case no match could be found an empty {@link Iterable}
* is returned.
*
* @param example can be {@literal null}.
* @param example must not be {@literal null}.
* @return all entities matching the given {@link Example}.
*/
<S extends T> Iterable<S> findAll(Example<S> example);
@ -54,7 +54,7 @@ public interface QueryByExampleExecutor<T> { @@ -54,7 +54,7 @@ public interface QueryByExampleExecutor<T> {
* Returns all entities matching the given {@link Example} applying the given {@link Sort}. In case no match could be
* found an empty {@link Iterable} is returned.
*
* @param example can be {@literal null}.
* @param example must not be {@literal null}.
* @param sort the {@link Sort} specification to sort the results by, must not be {@literal null}.
* @return all entities matching the given {@link Example}.
* @since 1.10
@ -65,7 +65,7 @@ public interface QueryByExampleExecutor<T> { @@ -65,7 +65,7 @@ public interface QueryByExampleExecutor<T> {
* Returns a {@link Page} of entities matching the given {@link Example}. In case no match could be found, an empty
* {@link Page} is returned.
*
* @param example can be {@literal null}.
* @param example must not be {@literal null}.
* @param pageable can be {@literal null}.
* @return a {@link Page} of entities matching the given {@link Example}.
*/
@ -74,7 +74,7 @@ public interface QueryByExampleExecutor<T> { @@ -74,7 +74,7 @@ public interface QueryByExampleExecutor<T> {
/**
* Returns the number of instances matching the given {@link Example}.
*
* @param example the {@link Example} to count instances for, can be {@literal null}.
* @param example the {@link Example} to count instances for. Must not be {@literal null}.
* @return the number of instances matching the {@link Example}.
*/
<S extends T> long count(Example<S> example);
@ -82,7 +82,7 @@ public interface QueryByExampleExecutor<T> { @@ -82,7 +82,7 @@ public interface QueryByExampleExecutor<T> {
/**
* Checks whether the data store contains elements that match the given {@link Example}.
*
* @param example the {@link Example} to use for the existence check, can be {@literal null}.
* @param example the {@link Example} 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 Example}.
*/
<S extends T> boolean exists(Example<S> example);

23
src/main/java/org/springframework/data/repository/query/ReactiveQueryByExampleExecutor.java

@ -26,32 +26,35 @@ import org.springframework.data.domain.Sort; @@ -26,32 +26,35 @@ import org.springframework.data.domain.Sort;
*
* @param <T>
* @author Mark Paluch
* @author Christoph Strobl
* @since 2.0
*/
public interface ReactiveQueryByExampleExecutor<T> {
/**
* Returns a single entity matching the given {@link Example} or {@literal null} if none was found.
* Returns a single entity matching the given {@link Example} or {@link Mono#empty()} if none was found.
*
* @param example can be {@literal null}.
* @return a single entity matching the given {@link Example} or {@literal null} if none was found.
* @param example must not be {@literal null}.
* @return a single entity matching the given {@link Example} or {@link Mono#empty()} if none was found.
* @throws org.springframework.dao.IncorrectResultSizeDataAccessException via {@link Mono#error(Throwable)} if the
* example yields more than one result.
*/
<S extends T> Mono<S> findOne(Example<S> example);
/**
* Returns all entities matching the given {@link Example}. In case no match could be found an empty {@link Iterable}
* is returned.
* Returns all entities matching the given {@link Example}. In case no match could be found {@link Flux#empty()} is
* returned.
*
* @param example can be {@literal null}.
* @param example must not be {@literal null}.
* @return all entities matching the given {@link Example}.
*/
<S extends T> Flux<S> findAll(Example<S> example);
/**
* Returns all entities matching the given {@link Example} applying the given {@link Sort}. In case no match could be
* found an empty {@link Iterable} is returned.
* found {@link Flux#empty()} is returned.
*
* @param example can be {@literal null}.
* @param example must not be {@literal null}.
* @param sort the {@link Sort} specification to sort the results by, must not be {@literal null}.
* @return all entities matching the given {@link Example}.
*/
@ -60,7 +63,7 @@ public interface ReactiveQueryByExampleExecutor<T> { @@ -60,7 +63,7 @@ public interface ReactiveQueryByExampleExecutor<T> {
/**
* Returns the number of instances matching the given {@link Example}.
*
* @param example the {@link Example} to count instances for, can be {@literal null}.
* @param example the {@link Example} to count instances for. Must not be {@literal null}.
* @return the number of instances matching the {@link Example}.
*/
<S extends T> Mono<Long> count(Example<S> example);
@ -68,7 +71,7 @@ public interface ReactiveQueryByExampleExecutor<T> { @@ -68,7 +71,7 @@ public interface ReactiveQueryByExampleExecutor<T> {
/**
* Checks whether the data store contains elements that match the given {@link Example}.
*
* @param example the {@link Example} to use for the existence check, can be {@literal null}.
* @param example the {@link Example} 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 Example}.
*/
<S extends T> Mono<Boolean> exists(Example<S> example);

Loading…
Cancel
Save