@@ -42,98 +42,112 @@ public interface RxJava2CrudRepository<T, ID> extends Repository<T, ID> {
42
42
* entity instance completely.
43
43
*
44
44
* @param entity must not be {@literal null}.
45
- * @return the saved entity.
45
+ * @return {@link Single} emitting the saved entity.
46
+ * @throws IllegalArgumentException in case the given {@code entity} is {@literal null}.
46
47
*/
47
48
<S extends T > Single <S > save (S entity );
48
49
49
50
/**
50
51
* Saves all given entities.
51
52
*
52
53
* @param entities must not be {@literal null}.
53
- * @return the saved entities.
54
- * @throws IllegalArgumentException in case the given entity is {@literal null}.
54
+ * @return {@link Flowable} emitting the saved entities.
55
+ * @throws IllegalArgumentException in case the given {@link Iterable entities} or one of its entities is
56
+ * {@literal null}.
55
57
*/
56
58
<S extends T > Flowable <S > saveAll (Iterable <S > entities );
57
59
58
60
/**
59
61
* Saves all given entities.
60
62
*
61
63
* @param entityStream must not be {@literal null}.
62
- * @return the saved entities.
63
- * @throws IllegalArgumentException in case the given {@code Publisher } is {@literal null}.
64
+ * @return {@link Flowable} emitting the saved entities.
65
+ * @throws IllegalArgumentException in case the given {@link Flowable entityStream } is {@literal null}.
64
66
*/
65
67
<S extends T > Flowable <S > saveAll (Flowable <S > entityStream );
66
68
67
69
/**
68
70
* Retrieves an entity by its id.
69
71
*
70
72
* @param id must not be {@literal null}.
71
- * @return the entity with the given id or {@link Maybe#empty()} if none found.
72
- * @throws IllegalArgumentException if {@code id} is {@literal null}.
73
+ * @return {@link Maybe} emitting the entity with the given id or {@link Maybe#empty()} if none found.
74
+ * @throws IllegalArgumentException in case the given {@code id} is {@literal null}.
73
75
*/
74
76
Maybe <T > findById (ID id );
75
77
76
78
/**
77
79
* Retrieves an entity by its id supplied by a {@link Single}.
78
80
*
79
- * @param id must not be {@literal null}.
80
- * @return the entity with the given id or {@link Maybe#empty()} if none found.
81
- * @throws IllegalArgumentException if {@code id} is {@literal null}.
81
+ * @param id must not be {@literal null}. Uses the first emitted element to perform the find-query.
82
+ * @return {@link Maybe} emitting the entity with the given id or {@link Maybe#empty()} if none found.
83
+ * @throws IllegalArgumentException in case the given {@link Single id} is {@literal null}.
82
84
*/
83
85
Maybe <T > findById (Single <ID > id );
84
86
85
87
/**
86
- * Returns whether an entity with the given id exists.
88
+ * Returns whether an entity with the given {@code id} exists.
87
89
*
88
90
* @param id must not be {@literal null}.
89
- * @return {@literal true} if an entity with the given id exists, {@literal false} otherwise.
90
- * @throws IllegalArgumentException if {@code id} is {@literal null}.
91
+ * @return {@link Single} emitting {@ literal true} if an entity with the given id exists, {@literal false} otherwise.
92
+ * @throws IllegalArgumentException in case the given {@code id} is {@literal null}.
91
93
*/
92
94
Single <Boolean > existsById (ID id );
93
95
94
96
/**
95
97
* Returns whether an entity with the given id, supplied by a {@link Single}, exists.
96
98
*
97
99
* @param id must not be {@literal null}.
98
- * @return {@literal true} if an entity with the given id exists, {@literal false} otherwise.
99
- * @throws IllegalArgumentException if {@code id} is {@literal null}
100
+ * @return {@link Single} emitting {@ literal true} if an entity with the given id exists, {@literal false} otherwise.
101
+ * @throws IllegalArgumentException in case the given {@link Single id} is {@literal null}.
100
102
*/
101
103
Single <Boolean > existsById (Single <ID > id );
102
104
103
105
/**
104
106
* Returns all instances of the type.
105
107
*
106
- * @return all entities.
108
+ * @return {@link Flowable} emitting all entities.
107
109
*/
108
110
Flowable <T > findAll ();
109
111
110
112
/**
111
- * Returns all instances of the type with the given IDs.
113
+ * Returns all instances of the type {@code T} with the given IDs.
114
+ * <p>
115
+ * If some or all ids are not found, no entities are returned for these IDs.
116
+ * <p>
117
+ * Note that the order of elements in the result is not guaranteed.
112
118
*
113
- * @param ids must not be {@literal null}.
114
- * @return the found entities.
119
+ * @param ids must not be {@literal null} nor contain any {@literal null} values.
120
+ * @return {@link Flowable} emitting the found entities. The size can be equal or less than the number of given
121
+ * {@code ids}.
122
+ * @throws IllegalArgumentException in case the given {@link Iterable ids} or one of its items is {@literal null}.
115
123
*/
116
124
Flowable <T > findAllById (Iterable <ID > ids );
117
125
118
126
/**
119
- * Returns all instances of the type with the given IDs.
127
+ * Returns all instances of the type {@code T} with the given IDs supplied by a {@link Flowable}.
128
+ * <p>
129
+ * If some or all ids are not found, no entities are returned for these IDs.
130
+ * <p>
131
+ * Note that the order of elements in the result is not guaranteed.
120
132
*
121
133
* @param idStream must not be {@literal null}.
122
- * @return the found entities.
134
+ * @return {@link Flowable} emitting the found entities.
135
+ * @throws IllegalArgumentException in case the given {@link Flowable idStream} is {@literal null}.
123
136
*/
124
137
Flowable <T > findAllById (Flowable <ID > idStream );
125
138
126
139
/**
127
140
* Returns the number of entities available.
128
141
*
129
- * @return the number of entities.
142
+ * @return {@link Single} emitting the number of entities.
130
143
*/
131
144
Single <Long > count ();
132
145
133
146
/**
134
147
* Deletes the entity with the given id.
135
148
*
136
149
* @param id must not be {@literal null}.
150
+ * @return {@link Completable} signaling when operation has completed.
137
151
* @throws IllegalArgumentException in case the given {@code id} is {@literal null}.
138
152
*/
139
153
Completable deleteById (ID id );
@@ -142,6 +156,7 @@ public interface RxJava2CrudRepository<T, ID> extends Repository<T, ID> {
142
156
* Deletes a given entity.
143
157
*
144
158
* @param entity must not be {@literal null}.
159
+ * @return {@link Completable} signaling when operation has completed.
145
160
* @throws IllegalArgumentException in case the given entity is {@literal null}.
146
161
*/
147
162
Completable delete (T entity );
@@ -150,20 +165,25 @@ public interface RxJava2CrudRepository<T, ID> extends Repository<T, ID> {
150
165
* Deletes the given entities.
151
166
*
152
167
* @param entities must not be {@literal null}.
153
- * @throws IllegalArgumentException in case the given {@link Iterable} is {@literal null}.
168
+ * @return {@link Completable} signaling when operation has completed.
169
+ * @throws IllegalArgumentException in case the given {@link Iterable entities} or one of its entities is
170
+ * {@literal null}.
154
171
*/
155
172
Completable deleteAll (Iterable <? extends T > entities );
156
173
157
174
/**
158
- * Deletes the given entities.
175
+ * Deletes the given entities supplied by a {@link Flowable} .
159
176
*
160
177
* @param entityStream must not be {@literal null}.
161
- * @throws IllegalArgumentException in case the given {@link Flowable} is {@literal null}.
178
+ * @return {@link Completable} signaling when operation has completed.
179
+ * @throws IllegalArgumentException in case the given {@link Flowable entityStream} is {@literal null}.
162
180
*/
163
181
Completable deleteAll (Flowable <? extends T > entityStream );
164
182
165
183
/**
166
184
* Deletes all entities managed by the repository.
185
+ *
186
+ * @return {@link Completable} signaling when operation has completed.
167
187
*/
168
188
Completable deleteAll ();
169
189
}
0 commit comments