@@ -152,6 +152,9 @@ public <T> T update(T instance) {
152
152
*/
153
153
@ Override
154
154
public long count (Class <?> domainType ) {
155
+
156
+ Assert .notNull (domainType , "Domain type must not be null" );
157
+
155
158
return accessStrategy .count (domainType );
156
159
}
157
160
@@ -162,6 +165,9 @@ public long count(Class<?> domainType) {
162
165
@ Override
163
166
public <T > T findById (Object id , Class <T > domainType ) {
164
167
168
+ Assert .notNull (id , "Id must not be null" );
169
+ Assert .notNull (domainType , "Domain type must not be null" );
170
+
165
171
T entity = accessStrategy .findById (id , domainType );
166
172
if (entity != null ) {
167
173
publishAfterLoad (id , entity );
@@ -175,6 +181,10 @@ public <T> T findById(Object id, Class<T> domainType) {
175
181
*/
176
182
@ Override
177
183
public <T > boolean existsById (Object id , Class <T > domainType ) {
184
+
185
+ Assert .notNull (id , "Id must not be null" );
186
+ Assert .notNull (domainType , "Domain type must not be null" );
187
+
178
188
return accessStrategy .existsById (id , domainType );
179
189
}
180
190
@@ -185,6 +195,8 @@ public <T> boolean existsById(Object id, Class<T> domainType) {
185
195
@ Override
186
196
public <T > Iterable <T > findAll (Class <T > domainType ) {
187
197
198
+ Assert .notNull (domainType , "Domain type must not be null" );
199
+
188
200
Iterable <T > all = accessStrategy .findAll (domainType );
189
201
publishAfterLoad (all );
190
202
return all ;
@@ -197,6 +209,9 @@ public <T> Iterable<T> findAll(Class<T> domainType) {
197
209
@ Override
198
210
public <T > Iterable <T > findAllById (Iterable <?> ids , Class <T > domainType ) {
199
211
212
+ Assert .notNull (ids , "Ids must not be null" );
213
+ Assert .notNull (domainType , "Domain type must not be null" );
214
+
200
215
Iterable <T > allById = accessStrategy .findAllById (ids , domainType );
201
216
publishAfterLoad (allById );
202
217
return allById ;
@@ -209,6 +224,9 @@ public <T> Iterable<T> findAllById(Iterable<?> ids, Class<T> domainType) {
209
224
@ Override
210
225
public <S > void delete (S aggregateRoot , Class <S > domainType ) {
211
226
227
+ Assert .notNull (aggregateRoot , "Aggregate root must not be null" );
228
+ Assert .notNull (domainType , "Domain type must not be null" );
229
+
212
230
IdentifierAccessor identifierAccessor = context .getRequiredPersistentEntity (domainType )
213
231
.getIdentifierAccessor (aggregateRoot );
214
232
@@ -221,6 +239,10 @@ public <S> void delete(S aggregateRoot, Class<S> domainType) {
221
239
*/
222
240
@ Override
223
241
public <S > void deleteById (Object id , Class <S > domainType ) {
242
+
243
+ Assert .notNull (id , "Id must not be null" );
244
+ Assert .notNull (domainType , "Domain type must not be null" );
245
+
224
246
deleteTree (id , null , domainType );
225
247
}
226
248
@@ -231,6 +253,8 @@ public <S> void deleteById(Object id, Class<S> domainType) {
231
253
@ Override
232
254
public void deleteAll (Class <?> domainType ) {
233
255
256
+ Assert .notNull (domainType , "Domain type must not be null" );
257
+
234
258
AggregateChange <?> change = createDeletingChange (domainType );
235
259
change .executeWith (interpreter , context , converter );
236
260
}
0 commit comments