Skip to content

Commit 52e4044

Browse files
DATACMNS-995 - Polishing.
Update JavaDoc to reflect reactive types, not null arguments and potential exceptions. Align not null JavaDoc of imperative QueryByExample interface.
1 parent f20b571 commit 52e4044

File tree

2 files changed

+19
-16
lines changed

2 files changed

+19
-16
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public interface QueryByExampleExecutor<T> {
3535
/**
3636
* Returns a single entity matching the given {@link Example} or {@literal null} if none was found.
3737
*
38-
* @param example can be {@literal null}.
38+
* @param example must not be {@literal null}.
3939
* @return a single entity matching the given {@link Example} or {@link Optional#empty()} if none was found.
4040
* @throws org.springframework.dao.IncorrectResultSizeDataAccessException if the Example yields more than one result.
4141
*/
@@ -45,7 +45,7 @@ public interface QueryByExampleExecutor<T> {
4545
* Returns all entities matching the given {@link Example}. In case no match could be found an empty {@link Iterable}
4646
* is returned.
4747
*
48-
* @param example can be {@literal null}.
48+
* @param example must not be {@literal null}.
4949
* @return all entities matching the given {@link Example}.
5050
*/
5151
<S extends T> Iterable<S> findAll(Example<S> example);
@@ -54,7 +54,7 @@ public interface QueryByExampleExecutor<T> {
5454
* Returns all entities matching the given {@link Example} applying the given {@link Sort}. In case no match could be
5555
* found an empty {@link Iterable} is returned.
5656
*
57-
* @param example can be {@literal null}.
57+
* @param example must not be {@literal null}.
5858
* @param sort the {@link Sort} specification to sort the results by, must not be {@literal null}.
5959
* @return all entities matching the given {@link Example}.
6060
* @since 1.10
@@ -65,7 +65,7 @@ public interface QueryByExampleExecutor<T> {
6565
* Returns a {@link Page} of entities matching the given {@link Example}. In case no match could be found, an empty
6666
* {@link Page} is returned.
6767
*
68-
* @param example can be {@literal null}.
68+
* @param example must not be {@literal null}.
6969
* @param pageable can be {@literal null}.
7070
* @return a {@link Page} of entities matching the given {@link Example}.
7171
*/
@@ -74,15 +74,15 @@ public interface QueryByExampleExecutor<T> {
7474
/**
7575
* Returns the number of instances matching the given {@link Example}.
7676
*
77-
* @param example the {@link Example} to count instances for, can be {@literal null}.
77+
* @param example the {@link Example} to count instances for. Must not be {@literal null}.
7878
* @return the number of instances matching the {@link Example}.
7979
*/
8080
<S extends T> long count(Example<S> example);
8181

8282
/**
8383
* Checks whether the data store contains elements that match the given {@link Example}.
8484
*
85-
* @param example the {@link Example} to use for the existence check, can be {@literal null}.
85+
* @param example the {@link Example} to use for the existence check. Must not be {@literal null}.
8686
* @return {@literal true} if the data store contains elements that match the given {@link Example}.
8787
*/
8888
<S extends T> boolean exists(Example<S> example);

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

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,32 +26,35 @@
2626
*
2727
* @param <T>
2828
* @author Mark Paluch
29+
* @author Christoph Strobl
2930
* @since 2.0
3031
*/
3132
public interface ReactiveQueryByExampleExecutor<T> {
3233

3334
/**
34-
* Returns a single entity matching the given {@link Example} or {@literal null} if none was found.
35+
* Returns a single entity matching the given {@link Example} or {@link Mono#empty()} if none was found.
3536
*
36-
* @param example can be {@literal null}.
37-
* @return a single entity matching the given {@link Example} or {@literal null} if none was found.
37+
* @param example must not be {@literal null}.
38+
* @return a single entity matching the given {@link Example} or {@link Mono#empty()} if none was found.
39+
* @throws @throws org.springframework.dao.IncorrectResultSizeDataAccessException if the example yields more than one
40+
* result.
3841
*/
3942
<S extends T> Mono<S> findOne(Example<S> example);
4043

4144
/**
42-
* Returns all entities matching the given {@link Example}. In case no match could be found an empty {@link Iterable}
43-
* is returned.
45+
* Returns all entities matching the given {@link Example}. In case no match could be found {@link Flux#empty()} is
46+
* returned.
4447
*
45-
* @param example can be {@literal null}.
48+
* @param example must not be {@literal null}.
4649
* @return all entities matching the given {@link Example}.
4750
*/
4851
<S extends T> Flux<S> findAll(Example<S> example);
4952

5053
/**
5154
* Returns all entities matching the given {@link Example} applying the given {@link Sort}. In case no match could be
52-
* found an empty {@link Iterable} is returned.
55+
* found {@link Flux#empty()} is returned.
5356
*
54-
* @param example can be {@literal null}.
57+
* @param example must not be {@literal null}.
5558
* @param sort the {@link Sort} specification to sort the results by, must not be {@literal null}.
5659
* @return all entities matching the given {@link Example}.
5760
*/
@@ -60,15 +63,15 @@ public interface ReactiveQueryByExampleExecutor<T> {
6063
/**
6164
* Returns the number of instances matching the given {@link Example}.
6265
*
63-
* @param example the {@link Example} to count instances for, can be {@literal null}.
66+
* @param example the {@link Example} to count instances for. Must not be {@literal null}.
6467
* @return the number of instances matching the {@link Example}.
6568
*/
6669
<S extends T> Mono<Long> count(Example<S> example);
6770

6871
/**
6972
* Checks whether the data store contains elements that match the given {@link Example}.
7073
*
71-
* @param example the {@link Example} to use for the existence check, can be {@literal null}.
74+
* @param example the {@link Example} to use for the existence check. Must not be {@literal null}.
7275
* @return {@literal true} if the data store contains elements that match the given {@link Example}.
7376
*/
7477
<S extends T> Mono<Boolean> exists(Example<S> example);

0 commit comments

Comments
 (0)