Skip to content

Commit 0aa9203

Browse files
committed
Polishing.
Add missing Override annotations to template API methods. See #3984
1 parent 8aa52c1 commit 0aa9203

File tree

2 files changed

+100
-0
lines changed

2 files changed

+100
-0
lines changed

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoTemplate.java

+30
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ public void setReadPreference(@Nullable ReadPreference readPreference) {
315315
* (non-Javadoc)
316316
* @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext)
317317
*/
318+
@Override
318319
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
319320

320321
prepareIndexCreator(applicationContext);
@@ -380,6 +381,7 @@ private void prepareIndexCreator(ApplicationContext context) {
380381
*
381382
* @return
382383
*/
384+
@Override
383385
public MongoConverter getConverter() {
384386
return this.mongoConverter;
385387
}
@@ -519,6 +521,7 @@ protected void executeQuery(Query query, String collectionName, DocumentCallback
519521
* (non-Javadoc)
520522
* @see org.springframework.data.mongodb.core.MongoOperations#execute(org.springframework.data.mongodb.core.DbCallback)
521523
*/
524+
@Override
522525
public <T> T execute(DbCallback<T> action) {
523526

524527
Assert.notNull(action, "DbCallback must not be null!");
@@ -535,6 +538,7 @@ public <T> T execute(DbCallback<T> action) {
535538
* (non-Javadoc)
536539
* @see org.springframework.data.mongodb.core.MongoOperations#execute(java.lang.Class, org.springframework.data.mongodb.core.DbCallback)
537540
*/
541+
@Override
538542
public <T> T execute(Class<?> entityClass, CollectionCallback<T> callback) {
539543

540544
Assert.notNull(entityClass, "EntityClass must not be null!");
@@ -545,6 +549,7 @@ public <T> T execute(Class<?> entityClass, CollectionCallback<T> callback) {
545549
* (non-Javadoc)
546550
* @see org.springframework.data.mongodb.core.MongoOperations#execute(java.lang.String, org.springframework.data.mongodb.core.DbCallback)
547551
*/
552+
@Override
548553
public <T> T execute(String collectionName, CollectionCallback<T> callback) {
549554

550555
Assert.notNull(collectionName, "CollectionName must not be null!");
@@ -597,6 +602,7 @@ public void setSessionSynchronization(SessionSynchronization sessionSynchronizat
597602
* (non-Javadoc)
598603
* @see org.springframework.data.mongodb.core.MongoOperations#createCollection(java.lang.Class)
599604
*/
605+
@Override
600606
public <T> MongoCollection<Document> createCollection(Class<T> entityClass) {
601607
return createCollection(entityClass, operations.forType(entityClass).getCollectionOptions());
602608
}
@@ -605,6 +611,7 @@ public <T> MongoCollection<Document> createCollection(Class<T> entityClass) {
605611
* (non-Javadoc)
606612
* @see org.springframework.data.mongodb.core.MongoOperations#createCollection(java.lang.Class, org.springframework.data.mongodb.core.CollectionOptions)
607613
*/
614+
@Override
608615
public <T> MongoCollection<Document> createCollection(Class<T> entityClass,
609616
@Nullable CollectionOptions collectionOptions) {
610617

@@ -623,6 +630,7 @@ public <T> MongoCollection<Document> createCollection(Class<T> entityClass,
623630
* (non-Javadoc)
624631
* @see org.springframework.data.mongodb.core.MongoOperations#createCollection(java.lang.String)
625632
*/
633+
@Override
626634
public MongoCollection<Document> createCollection(String collectionName) {
627635

628636
Assert.notNull(collectionName, "CollectionName must not be null!");
@@ -634,6 +642,7 @@ public MongoCollection<Document> createCollection(String collectionName) {
634642
* (non-Javadoc)
635643
* @see org.springframework.data.mongodb.core.MongoOperations#createCollection(java.lang.String, org.springframework.data.mongodb.core.CollectionOptions)
636644
*/
645+
@Override
637646
public MongoCollection<Document> createCollection(String collectionName,
638647
@Nullable CollectionOptions collectionOptions) {
639648

@@ -645,6 +654,7 @@ public MongoCollection<Document> createCollection(String collectionName,
645654
* (non-Javadoc)
646655
* @see org.springframework.data.mongodb.core.MongoOperations#getCollection(java.lang.String)
647656
*/
657+
@Override
648658
@SuppressWarnings("ConstantConditions")
649659
public MongoCollection<Document> getCollection(String collectionName) {
650660

@@ -657,6 +667,7 @@ public MongoCollection<Document> getCollection(String collectionName) {
657667
* (non-Javadoc)
658668
* @see org.springframework.data.mongodb.core.ExecutableInsertOperation#getCollection(java.lang.Class)
659669
*/
670+
@Override
660671
public <T> boolean collectionExists(Class<T> entityClass) {
661672
return collectionExists(getCollectionName(entityClass));
662673
}
@@ -665,6 +676,7 @@ public <T> boolean collectionExists(Class<T> entityClass) {
665676
* (non-Javadoc)
666677
* @see org.springframework.data.mongodb.core.ExecutableInsertOperation#getCollection(java.lang.String)
667678
*/
679+
@Override
668680
@SuppressWarnings("ConstantConditions")
669681
public boolean collectionExists(String collectionName) {
670682

@@ -685,6 +697,7 @@ public boolean collectionExists(String collectionName) {
685697
* (non-Javadoc)
686698
* @see org.springframework.data.mongodb.core.ExecutableInsertOperation#dropCollection(java.lang.Class)
687699
*/
700+
@Override
688701
public <T> void dropCollection(Class<T> entityClass) {
689702
dropCollection(getCollectionName(entityClass));
690703
}
@@ -693,6 +706,7 @@ public <T> void dropCollection(Class<T> entityClass) {
693706
* (non-Javadoc)
694707
* @see org.springframework.data.mongodb.core.ExecutableInsertOperation#dropCollection(java.lang.String)
695708
*/
709+
@Override
696710
public void dropCollection(String collectionName) {
697711

698712
Assert.notNull(collectionName, "CollectionName must not be null!");
@@ -716,6 +730,7 @@ public IndexOperations indexOps(String collectionName) {
716730
* (non-Javadoc)
717731
* @see org.springframework.data.mongodb.core.ExecutableInsertOperation#indexOps(java.lang.String)
718732
*/
733+
@Override
719734
public IndexOperations indexOps(String collectionName, @Nullable Class<?> type) {
720735
return new DefaultIndexOperations(this, collectionName, type);
721736
}
@@ -724,6 +739,7 @@ public IndexOperations indexOps(String collectionName, @Nullable Class<?> type)
724739
* (non-Javadoc)
725740
* @see org.springframework.data.mongodb.core.ExecutableInsertOperation#indexOps(java.lang.Class)
726741
*/
742+
@Override
727743
public IndexOperations indexOps(Class<?> entityClass) {
728744
return indexOps(getCollectionName(entityClass), entityClass);
729745
}
@@ -732,6 +748,7 @@ public IndexOperations indexOps(Class<?> entityClass) {
732748
* (non-Javadoc)
733749
* @see org.springframework.data.mongodb.core.ExecutableInsertOperation#bulkOps(org.springframework.data.mongodb.core.BulkMode, java.lang.String)
734750
*/
751+
@Override
735752
public BulkOperations bulkOps(BulkMode bulkMode, String collectionName) {
736753
return bulkOps(bulkMode, null, collectionName);
737754
}
@@ -740,6 +757,7 @@ public BulkOperations bulkOps(BulkMode bulkMode, String collectionName) {
740757
* (non-Javadoc)
741758
* @see org.springframework.data.mongodb.core.ExecutableInsertOperation#bulkOps(org.springframework.data.mongodb.core.BulkMode, java.lang.Class)
742759
*/
760+
@Override
743761
public BulkOperations bulkOps(BulkMode bulkMode, Class<?> entityClass) {
744762
return bulkOps(bulkMode, entityClass, getCollectionName(entityClass));
745763
}
@@ -748,6 +766,7 @@ public BulkOperations bulkOps(BulkMode bulkMode, Class<?> entityClass) {
748766
* (non-Javadoc)
749767
* @see org.springframework.data.mongodb.core.ExecutableInsertOperation#bulkOps(org.springframework.data.mongodb.core.BulkMode, java.lang.Class, java.lang.String)
750768
*/
769+
@Override
751770
public BulkOperations bulkOps(BulkMode mode, @Nullable Class<?> entityType, String collectionName) {
752771

753772
Assert.notNull(mode, "BulkMode must not be null!");
@@ -1109,6 +1128,7 @@ public long count(Query query, String collectionName) {
11091128
* (non-Javadoc)
11101129
* @see org.springframework.data.mongodb.core.MongoOperations#count(org.springframework.data.mongodb.core.query.Query, java.lang.Class, java.lang.String)
11111130
*/
1131+
@Override
11121132
public long count(Query query, @Nullable Class<?> entityClass, String collectionName) {
11131133

11141134
Assert.notNull(query, "Query must not be null!");
@@ -1915,10 +1935,12 @@ public <T> List<T> mapReduce(Query query, Class<?> domainType, String inputColle
19151935
return mappedResults;
19161936
}
19171937

1938+
@Override
19181939
public <T> GroupByResults<T> group(String inputCollectionName, GroupBy groupBy, Class<T> entityClass) {
19191940
return group(null, inputCollectionName, groupBy, entityClass);
19201941
}
19211942

1943+
@Override
19221944
public <T> GroupByResults<T> group(@Nullable Criteria criteria, String inputCollectionName, GroupBy groupBy,
19231945
Class<T> entityClass) {
19241946

@@ -2325,6 +2347,7 @@ protected String replaceWithResourceIfNecessary(String function) {
23252347
* (non-Javadoc)
23262348
* @see org.springframework.data.mongodb.core.ExecutableInsertOperation#getCollectionNames()
23272349
*/
2350+
@Override
23282351
@SuppressWarnings("ConstantConditions")
23292352
public Set<String> getCollectionNames() {
23302353
return execute(db -> {
@@ -2974,6 +2997,7 @@ public FindCallback(Document query, Document fields, @Nullable com.mongodb.clien
29742997
this.collation = collation;
29752998
}
29762999

3000+
@Override
29773001
public FindIterable<Document> doInCollection(MongoCollection<Document> collection)
29783002
throws MongoException, DataAccessException {
29793003

@@ -3033,6 +3057,7 @@ private static class FindAndRemoveCallback implements CollectionCallback<Documen
30333057
this.collation = Optional.ofNullable(collation);
30343058
}
30353059

3060+
@Override
30363061
public Document doInCollection(MongoCollection<Document> collection) throws MongoException, DataAccessException {
30373062

30383063
FindOneAndDeleteOptions opts = new FindOneAndDeleteOptions().sort(sort).projection(fields);
@@ -3062,6 +3087,7 @@ private static class FindAndModifyCallback implements CollectionCallback<Documen
30623087
this.options = options;
30633088
}
30643089

3090+
@Override
30653091
public Document doInCollection(MongoCollection<Document> collection) throws MongoException, DataAccessException {
30663092

30673093
FindOneAndUpdateOptions opts = new FindOneAndUpdateOptions();
@@ -3174,6 +3200,7 @@ private class ReadDocumentCallback<T> implements DocumentCallback<T> {
31743200
this.collectionName = collectionName;
31753201
}
31763202

3203+
@Override
31773204
public T doWith(Document document) {
31783205

31793206
maybeEmitEvent(new AfterLoadEvent<>(document, type, collectionName));
@@ -3218,6 +3245,7 @@ private class ProjectingReadCallback<S, T> implements DocumentCallback<T> {
32183245
* (non-Javadoc)
32193246
* @see org.springframework.data.mongodb.core.MongoTemplate.DocumentCallback#doWith(org.bson.Document)
32203247
*/
3248+
@Override
32213249
@SuppressWarnings("unchecked")
32223250
public T doWith(Document document) {
32233251

@@ -3258,6 +3286,7 @@ class QueryCursorPreparer implements CursorPreparer {
32583286
* (non-Javadoc)
32593287
* @see org.springframework.data.mongodb.core.CursorPreparer#prepare(com.mongodb.DBCursor)
32603288
*/
3289+
@Override
32613290
public FindIterable<Document> prepare(FindIterable<Document> iterable) {
32623291

32633292
FindIterable<Document> cursorToUse = iterable;
@@ -3376,6 +3405,7 @@ static class GeoNearResultDocumentCallback<T> implements DocumentCallback<GeoRes
33763405
this.metric = metric;
33773406
}
33783407

3408+
@Override
33793409
public GeoResult<T> doWith(Document object) {
33803410

33813411
double distance = Double.NaN;

0 commit comments

Comments
 (0)