Skip to content

Commit b667314

Browse files
committed
DATAMONGO-1619 - Polishing.
Add override annotations. Add override Javadocs.
1 parent 04ee9af commit b667314

File tree

1 file changed

+90
-3
lines changed

1 file changed

+90
-3
lines changed

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/support/SimpleReactiveMongoRepository.java

Lines changed: 90 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717

1818
import static org.springframework.data.mongodb.core.query.Criteria.*;
1919

20+
import reactor.core.publisher.Flux;
21+
import reactor.core.publisher.Mono;
22+
2023
import java.io.Serializable;
2124
import java.util.ArrayList;
2225
import java.util.Collection;
@@ -35,9 +38,6 @@
3538
import org.springframework.data.mongodb.repository.query.MongoEntityInformation;
3639
import org.springframework.util.Assert;
3740

38-
import reactor.core.publisher.Flux;
39-
import reactor.core.publisher.Mono;
40-
4141
/**
4242
* Reactive repository base implementation for Mongo.
4343
*
@@ -66,13 +66,21 @@ public SimpleReactiveMongoRepository(MongoEntityInformation<T, ID> metadata,
6666
this.mongoOperations = mongoOperations;
6767
}
6868

69+
/* (non-Javadoc)
70+
* @see org.springframework.data.repository.reactive.ReactiveCrudRepository#findOne(java.io.Serializable)
71+
*/
72+
@Override
6973
public Mono<T> findOne(ID id) {
7074

7175
Assert.notNull(id, "The given id must not be null!");
7276

7377
return mongoOperations.findById(id, entityInformation.getJavaType(), entityInformation.getCollectionName());
7478
}
7579

80+
/* (non-Javadoc)
81+
* @see org.springframework.data.repository.reactive.ReactiveCrudRepository#findOne(reactor.core.publisher.Mono)
82+
*/
83+
@Override
7684
public Mono<T> findOne(Mono<ID> mono) {
7785

7886
Assert.notNull(mono, "The given id must not be null!");
@@ -81,6 +89,9 @@ public Mono<T> findOne(Mono<ID> mono) {
8189
id -> mongoOperations.findById(id, entityInformation.getJavaType(), entityInformation.getCollectionName()));
8290
}
8391

92+
/* (non-Javadoc)
93+
* @see org.springframework.data.repository.query.ReactiveQueryByExampleExecutor#findOne(org.springframework.data.domain.Example)
94+
*/
8495
public <S extends T> Mono<S> findOne(Example<S> example) {
8596

8697
Assert.notNull(example, "Sample must not be null!");
@@ -89,6 +100,10 @@ public <S extends T> Mono<S> findOne(Example<S> example) {
89100
return mongoOperations.findOne(q, example.getProbeType(), entityInformation.getCollectionName());
90101
}
91102

103+
/* (non-Javadoc)
104+
* @see org.springframework.data.repository.reactive.ReactiveCrudRepository#exists(java.io.Serializable)
105+
*/
106+
@Override
92107
public Mono<Boolean> exists(ID id) {
93108

94109
Assert.notNull(id, "The given id must not be null!");
@@ -97,6 +112,10 @@ public Mono<Boolean> exists(ID id) {
97112
entityInformation.getCollectionName());
98113
}
99114

115+
/* (non-Javadoc)
116+
* @see org.springframework.data.repository.reactive.ReactiveCrudRepository#exists(reactor.core.publisher.Mono)
117+
*/
118+
@Override
100119
public Mono<Boolean> exists(Mono<ID> mono) {
101120

102121
Assert.notNull(mono, "The given id must not be null!");
@@ -106,6 +125,10 @@ public Mono<Boolean> exists(Mono<ID> mono) {
106125

107126
}
108127

128+
/* (non-Javadoc)
129+
* @see org.springframework.data.repository.query.ReactiveQueryByExampleExecutor#exists(org.springframework.data.domain.Example)
130+
*/
131+
@Override
109132
public <S extends T> Mono<Boolean> exists(Example<S> example) {
110133

111134
Assert.notNull(example, "Sample must not be null!");
@@ -114,11 +137,17 @@ public <S extends T> Mono<Boolean> exists(Example<S> example) {
114137
return mongoOperations.exists(q, example.getProbeType(), entityInformation.getCollectionName());
115138
}
116139

140+
/* (non-Javadoc)
141+
* @see org.springframework.data.repository.reactive.ReactiveSortingRepository#findAll()
142+
*/
117143
@Override
118144
public Flux<T> findAll() {
119145
return findAll(new Query());
120146
}
121147

148+
/* (non-Javadoc)
149+
* @see org.springframework.data.repository.reactive.ReactiveSortingRepository#findAll(java.lang.Iterable)
150+
*/
122151
@Override
123152
public Flux<T> findAll(Iterable<ID> ids) {
124153

@@ -132,6 +161,9 @@ public Flux<T> findAll(Iterable<ID> ids) {
132161
return findAll(new Query(new Criteria(entityInformation.getIdAttribute()).in(parameters)));
133162
}
134163

164+
/* (non-Javadoc)
165+
* @see org.springframework.data.repository.reactive.ReactiveSortingRepository#findAll(org.reactivestreams.Publisher)
166+
*/
135167
@Override
136168
public Flux<T> findAll(Publisher<ID> idStream) {
137169

@@ -140,11 +172,17 @@ public Flux<T> findAll(Publisher<ID> idStream) {
140172
return Flux.from(idStream).buffer().flatMap(this::findAll);
141173
}
142174

175+
/* (non-Javadoc)
176+
* @see org.springframework.data.repository.reactive.ReactiveSortingRepository#findAll(org.springframework.data.domain.Sort)
177+
*/
143178
@Override
144179
public Flux<T> findAll(Sort sort) {
145180
return findAll(new Query().with(sort));
146181
}
147182

183+
/* (non-Javadoc)
184+
* @see org.springframework.data.repository.query.ReactiveQueryByExampleExecutor#findAll(org.springframework.data.domain.Example, org.springframework.data.domain.Sort)
185+
*/
148186
@Override
149187
public <S extends T> Flux<S> findAll(Example<S> example, Sort sort) {
150188

@@ -159,15 +197,26 @@ public <S extends T> Flux<S> findAll(Example<S> example, Sort sort) {
159197
return mongoOperations.find(q, example.getProbeType(), entityInformation.getCollectionName());
160198
}
161199

200+
/* (non-Javadoc)
201+
* @see org.springframework.data.repository.query.ReactiveQueryByExampleExecutor#findAll(org.springframework.data.domain.Example)
202+
*/
162203
@Override
163204
public <S extends T> Flux<S> findAll(Example<S> example) {
164205
return findAll(example, null);
165206
}
166207

208+
/* (non-Javadoc)
209+
* @see org.springframework.data.repository.reactive.ReactiveCrudRepository#count()
210+
*/
211+
@Override
167212
public Mono<Long> count() {
168213
return mongoOperations.count(new Query(), entityInformation.getCollectionName());
169214
}
170215

216+
/* (non-Javadoc)
217+
* @see org.springframework.data.repository.query.ReactiveQueryByExampleExecutor#count(org.springframework.data.domain.Example)
218+
*/
219+
@Override
171220
public <S extends T> Mono<Long> count(Example<S> example) {
172221

173222
Assert.notNull(example, "Sample must not be null!");
@@ -176,6 +225,9 @@ public <S extends T> Mono<Long> count(Example<S> example) {
176225
return mongoOperations.count(q, example.getProbeType(), entityInformation.getCollectionName());
177226
}
178227

228+
/* (non-Javadoc)
229+
* @see org.springframework.data.mongodb.repository.ReactiveMongoRepository#insert(java.lang.Object)
230+
*/
179231
@Override
180232
public <S extends T> Mono<S> insert(S entity) {
181233

@@ -184,6 +236,9 @@ public <S extends T> Mono<S> insert(S entity) {
184236
return mongoOperations.insert(entity, entityInformation.getCollectionName());
185237
}
186238

239+
/* (non-Javadoc)
240+
* @see org.springframework.data.mongodb.repository.ReactiveMongoRepository#insert(java.lang.Iterable)
241+
*/
187242
@Override
188243
public <S extends T> Flux<S> insert(Iterable<S> entities) {
189244

@@ -198,6 +253,9 @@ public <S extends T> Flux<S> insert(Iterable<S> entities) {
198253
return Flux.from(mongoOperations.insertAll(list));
199254
}
200255

256+
/* (non-Javadoc)
257+
* @see org.springframework.data.mongodb.repository.ReactiveMongoRepository#insert(org.reactivestreams.Publisher)
258+
*/
201259
@Override
202260
public <S extends T> Flux<S> insert(Publisher<S> entities) {
203261

@@ -206,6 +264,10 @@ public <S extends T> Flux<S> insert(Publisher<S> entities) {
206264
return Flux.from(entities).flatMap(entity -> mongoOperations.insert(entity, entityInformation.getCollectionName()));
207265
}
208266

267+
/* (non-Javadoc)
268+
* @see org.springframework.data.repository.reactive.ReactiveCrudRepository#save(S)
269+
*/
270+
@Override
209271
public <S extends T> Mono<S> save(S entity) {
210272

211273
Assert.notNull(entity, "Entity must not be null!");
@@ -217,6 +279,10 @@ public <S extends T> Mono<S> save(S entity) {
217279
return mongoOperations.save(entity, entityInformation.getCollectionName());
218280
}
219281

282+
/* (non-Javadoc)
283+
* @see org.springframework.data.repository.reactive.ReactiveCrudRepository#save(java.lang.Iterable)
284+
*/
285+
@Override
220286
public <S extends T> Flux<S> save(Iterable<S> entities) {
221287

222288
Assert.notNull(entities, "The given Iterable of entities must not be null!");
@@ -242,6 +308,9 @@ public <S extends T> Flux<S> save(Iterable<S> entities) {
242308
return Flux.merge(monos);
243309
}
244310

311+
/* (non-Javadoc)
312+
* @see org.springframework.data.repository.reactive.ReactiveCrudRepository#save(org.reactivestreams.Publisher)
313+
*/
245314
@Override
246315
public <S extends T> Flux<S> save(Publisher<S> entityStream) {
247316

@@ -258,6 +327,10 @@ public <S extends T> Flux<S> save(Publisher<S> entityStream) {
258327
}
259328

260329
// TODO: should this one really be void?
330+
/* (non-Javadoc)
331+
* @see org.springframework.data.repository.reactive.ReactiveCrudRepository#delete(java.io.Serializable)
332+
*/
333+
@Override
261334
public Mono<Void> delete(ID id) {
262335

263336
Assert.notNull(id, "The given id must not be null!");
@@ -268,6 +341,10 @@ public Mono<Void> delete(ID id) {
268341
}
269342

270343
// TODO: should this one really be void?
344+
/* (non-Javadoc)
345+
* @see org.springframework.data.repository.reactive.ReactiveCrudRepository#delete(java.lang.Object)
346+
*/
347+
@Override
271348
public Mono<Void> delete(T entity) {
272349

273350
Assert.notNull(entity, "The given entity must not be null!");
@@ -276,6 +353,10 @@ public Mono<Void> delete(T entity) {
276353
}
277354

278355
// TODO: should this one really be void?
356+
/* (non-Javadoc)
357+
* @see org.springframework.data.repository.reactive.ReactiveCrudRepository#delete(java.lang.Iterable)
358+
*/
359+
@Override
279360
public Mono<Void> delete(Iterable<? extends T> entities) {
280361

281362
Assert.notNull(entities, "The given Iterable of entities must not be null!");
@@ -284,6 +365,9 @@ public Mono<Void> delete(Iterable<? extends T> entities) {
284365
}
285366

286367
// TODO: should this one really be void?
368+
/* (non-Javadoc)
369+
* @see org.springframework.data.repository.reactive.ReactiveCrudRepository#delete(org.reactivestreams.Publisher)
370+
*/
287371
@Override
288372
public Mono<Void> delete(Publisher<? extends T> entityStream) {
289373

@@ -293,6 +377,9 @@ public Mono<Void> delete(Publisher<? extends T> entityStream) {
293377
}
294378

295379
// TODO: should this one really be void?
380+
/* (non-Javadoc)
381+
* @see org.springframework.data.repository.reactive.ReactiveCrudRepository#deleteAll()
382+
*/
296383
public Mono<Void> deleteAll() {
297384
return mongoOperations.remove(new Query(), entityInformation.getCollectionName())
298385
.then(deleteResult -> Mono.empty());

0 commit comments

Comments
 (0)