Skip to content

Commit 3feed2b

Browse files
committed
DATAMONGO-1289 - Polishing.
Some additional JavaDoc and comment removal. Original pull request: #333.
1 parent 501b950 commit 3feed2b

File tree

3 files changed

+24
-6
lines changed

3 files changed

+24
-6
lines changed

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

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011-2015 by the original author(s).
2+
* Copyright 2011-2015 by the original author(s).
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -46,6 +46,13 @@ public MappingMongoEntityInformation(MongoPersistentEntity<T> entity) {
4646
this(entity, null, null);
4747
}
4848

49+
/**
50+
* Creates a new {@link MappingMongoEntityInformation} for the given {@link MongoPersistentEntity} and fallback
51+
* identifier type.
52+
*
53+
* @param entity must not be {@literal null}.
54+
* @param fallbackIdType can be {@literal null}.
55+
*/
4956
public MappingMongoEntityInformation(MongoPersistentEntity<T> entity, Class<ID> fallbackIdType) {
5057
this(entity, (String) null, fallbackIdType);
5158
}
@@ -61,7 +68,17 @@ public MappingMongoEntityInformation(MongoPersistentEntity<T> entity, String cus
6168
this(entity, customCollectionName, null);
6269
}
6370

64-
public MappingMongoEntityInformation(MongoPersistentEntity<T> entity, String customCollectionName, Class<ID> idType) {
71+
/**
72+
* Creates a new {@link MappingMongoEntityInformation} for the given {@link MongoPersistentEntity}, collection name
73+
* and identifier type.
74+
*
75+
* @param entity must not be {@literal null}.
76+
* @param customCollectionName can be {@literal null}.
77+
* @param idType can be {@literal null}.
78+
*/
79+
@SuppressWarnings("unchecked")
80+
private MappingMongoEntityInformation(MongoPersistentEntity<T> entity, String customCollectionName,
81+
Class<ID> idType) {
6582

6683
super(entity);
6784

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,6 @@ protected QueryLookupStrategy getQueryLookupStrategy(Key key, EvaluationContextP
108108
* (non-Javadoc)
109109
* @see org.springframework.data.repository.core.support.RepositoryFactorySupport#getEntityInformation(java.lang.Class)
110110
*/
111-
// TODO: would be worth discussing if we could alter RepositoryFactorySupport#getEntityInformation to be called with
112-
// RepositoryMetadata instead of the acual domain type class.
113111
public <T, ID extends Serializable> MongoEntityInformation<T, ID> getEntityInformation(Class<T> domainClass) {
114112
return getEntityInformation(domainClass, null);
115113
}
@@ -121,8 +119,8 @@ private <T, ID extends Serializable> MongoEntityInformation<T, ID> getEntityInfo
121119
MongoPersistentEntity<?> entity = mappingContext.getPersistentEntity(domainClass);
122120

123121
if (entity == null) {
124-
throw new MappingException(String.format("Could not lookup mapping metadata for domain class %s!",
125-
domainClass.getName()));
122+
throw new MappingException(
123+
String.format("Could not lookup mapping metadata for domain class %s!", domainClass.getName()));
126124
}
127125

128126
return new MappingMongoEntityInformation<T, ID>((MongoPersistentEntity<T>) entity,

spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/NoExplicitIdTests.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
import com.mongodb.MongoClient;
3838

3939
/**
40+
* Integration tests for DATAMONGO-1289.
41+
*
4042
* @author Christoph Strobl
4143
*/
4244
@RunWith(SpringJUnit4ClassRunner.class)
@@ -102,6 +104,7 @@ public void saveAndRetrieveTypeWithoutIdPorpertyViaRepository() {
102104
* @see DATAMONGO-1289
103105
*/
104106
@Test
107+
@SuppressWarnings("unchecked")
105108
public void saveAndRetrieveTypeWithoutIdPorpertyViaRepositoryFindOne() {
106109

107110
TypeWithoutIdProperty noid = new TypeWithoutIdProperty();

0 commit comments

Comments
 (0)