Skip to content

Commit f026ab4

Browse files
committed
DATAMONGO-1564 - Polishing.
Fix JavaDoc references and minor a import formatting issue. Original pull request: #429.
1 parent 7513904 commit f026ab4

File tree

14 files changed

+210
-194
lines changed

14 files changed

+210
-194
lines changed

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@
2121
import java.util.LinkedHashMap;
2222
import java.util.List;
2323

24+
import org.springframework.util.ObjectUtils;
25+
2426
import com.mongodb.BasicDBObject;
2527
import com.mongodb.DBObject;
26-
import org.springframework.util.ObjectUtils;
2728

2829
/**
2930
* @author Christoph Strobl
@@ -45,6 +46,7 @@ public DBObject toDbObject(AggregationOperationContext context) {
4546
return toDbObject(this.value, context);
4647
}
4748

49+
@SuppressWarnings("unchecked")
4850
public DBObject toDbObject(Object value, AggregationOperationContext context) {
4951

5052
Object valueToUse;
@@ -80,6 +82,7 @@ protected static List<Field> asFields(String... fieldRefs) {
8082
return Fields.fields(fieldRefs).asList();
8183
}
8284

85+
@SuppressWarnings("unchecked")
8386
private Object unpack(Object value, AggregationOperationContext context) {
8487

8588
if (value instanceof AggregationExpression) {
@@ -123,13 +126,13 @@ protected List<Object> append(Object value) {
123126
return Arrays.asList(this.value, value);
124127
}
125128

129+
@SuppressWarnings("unchecked")
126130
protected java.util.Map<String, Object> append(String key, Object value) {
127131

128132
if (!(this.value instanceof java.util.Map)) {
129133
throw new IllegalArgumentException("o_O");
130134
}
131-
java.util.Map<String, Object> clone = new LinkedHashMap<String, Object>(
132-
(java.util.Map<String, Object>) this.value);
135+
java.util.Map<String, Object> clone = new LinkedHashMap<String, Object>((java.util.Map<String, Object>) this.value);
133136
clone.put(key, value);
134137
return clone;
135138

@@ -143,7 +146,7 @@ protected List<Object> values() {
143146
if (value instanceof java.util.Map) {
144147
return new ArrayList<Object>(((java.util.Map) value).values());
145148
}
146-
return new ArrayList<Object>(Arrays.asList(value));
149+
return new ArrayList<Object>(Collections.singletonList(value));
147150
}
148151

149152
protected abstract String getMongoMethod();

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

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public static AccumulatorOperatorFactory valueOf(String fieldReference) {
4444
/**
4545
* Take the numeric value referenced resulting from given {@link AggregationExpression}.
4646
*
47-
* @param fieldReference must not be {@literal null}.
47+
* @param expression must not be {@literal null}.
4848
* @return
4949
*/
5050
public static AccumulatorOperatorFactory valueOf(AggregationExpression expression) {
@@ -72,7 +72,7 @@ public AccumulatorOperatorFactory(String fieldReference) {
7272
}
7373

7474
/**
75-
* Creates new {@link ArrayOperatorFactory} for given {@link AggregationExpression}.
75+
* Creates new {@link AccumulatorOperatorFactory} for given {@link AggregationExpression}.
7676
*
7777
* @param expression must not be {@literal null}.
7878
*/
@@ -84,7 +84,7 @@ public AccumulatorOperatorFactory(AggregationExpression expression) {
8484
}
8585

8686
/**
87-
* Creates new {@link AggregationExpressions} that takes the associated numeric value expression and calculates and
87+
* Creates new {@link AggregationExpression} that takes the associated numeric value expression and calculates and
8888
* returns the sum.
8989
*
9090
* @return
@@ -94,7 +94,7 @@ public Sum sum() {
9494
}
9595

9696
/**
97-
* Creates new {@link AggregationExpressions} that takes the associated numeric value expression and returns the
97+
* Creates new {@link AggregationExpression} that takes the associated numeric value expression and returns the
9898
* average value.
9999
*
100100
* @return
@@ -104,7 +104,7 @@ public Avg avg() {
104104
}
105105

106106
/**
107-
* Creates new {@link AggregationExpressions} that takes the associated numeric value expression and returns the
107+
* Creates new {@link AggregationExpression} that takes the associated numeric value expression and returns the
108108
* maximum value.
109109
*
110110
* @return
@@ -114,7 +114,7 @@ public Max max() {
114114
}
115115

116116
/**
117-
* Creates new {@link AggregationExpressions} that takes the associated numeric value expression and returns the
117+
* Creates new {@link AggregationExpression} that takes the associated numeric value expression and returns the
118118
* minimum value.
119119
*
120120
* @return
@@ -124,7 +124,7 @@ public Min min() {
124124
}
125125

126126
/**
127-
* Creates new {@link AggregationExpressions} that takes the associated numeric value expression and calculates the
127+
* Creates new {@link AggregationExpression} that takes the associated numeric value expression and calculates the
128128
* population standard deviation of the input values.
129129
*
130130
* @return
@@ -134,7 +134,7 @@ public StdDevPop stdDevPop() {
134134
}
135135

136136
/**
137-
* Creates new {@link AggregationExpressions} that takes the associated numeric value expression and calculates the
137+
* Creates new {@link AggregationExpression} that takes the associated numeric value expression and calculates the
138138
* sample standard deviation of the input values.
139139
*
140140
* @return
@@ -215,9 +215,10 @@ public Sum and(AggregationExpression expression) {
215215
}
216216

217217
/* (non-Javadoc)
218-
* @see org.springframework.data.mongodb.core.aggregation.AggregationExpressions.AbstractAggregationExpression#toDbObject(java.lang.Object, org.springframework.data.mongodb.core.aggregation.AggregationOperationContext)
218+
* @see org.springframework.data.mongodb.core.aggregation.AccumulatorOperators.AbstractAggregationExpression#toDbObject(java.lang.Object, org.springframework.data.mongodb.core.aggregation.AggregationOperationContext)
219219
*/
220220
@Override
221+
@SuppressWarnings("unchecked")
221222
public DBObject toDbObject(Object value, AggregationOperationContext context) {
222223

223224
if (value instanceof List) {
@@ -297,9 +298,10 @@ public Avg and(AggregationExpression expression) {
297298
}
298299

299300
/* (non-Javadoc)
300-
* @see org.springframework.data.mongodb.core.aggregation.AggregationExpressions.AbstractAggregationExpression#toDbObject(java.lang.Object, org.springframework.data.mongodb.core.aggregation.AggregationOperationContext)
301+
* @see org.springframework.data.mongodb.core.aggregation.AccumulatorOperators.AbstractAggregationExpression#toDbObject(java.lang.Object, org.springframework.data.mongodb.core.aggregation.AggregationOperationContext)
301302
*/
302303
@Override
304+
@SuppressWarnings("unchecked")
303305
public DBObject toDbObject(Object value, AggregationOperationContext context) {
304306

305307
if (value instanceof List) {
@@ -379,9 +381,10 @@ public Max and(AggregationExpression expression) {
379381
}
380382

381383
/* (non-Javadoc)
382-
* @see org.springframework.data.mongodb.core.aggregation.AggregationExpressions.AbstractAggregationExpression#toDbObject(java.lang.Object, org.springframework.data.mongodb.core.aggregation.AggregationOperationContext)
384+
* @see org.springframework.data.mongodb.core.aggregation.AccumulatorOperators.AbstractAggregationExpression#toDbObject(java.lang.Object, org.springframework.data.mongodb.core.aggregation.AggregationOperationContext)
383385
*/
384386
@Override
387+
@SuppressWarnings("unchecked")
385388
public DBObject toDbObject(Object value, AggregationOperationContext context) {
386389

387390
if (value instanceof List) {
@@ -461,9 +464,10 @@ public Min and(AggregationExpression expression) {
461464
}
462465

463466
/* (non-Javadoc)
464-
* @see org.springframework.data.mongodb.core.aggregation.AggregationExpressions.AbstractAggregationExpression#toDbObject(java.lang.Object, org.springframework.data.mongodb.core.aggregation.AggregationOperationContext)
467+
* @see org.springframework.data.mongodb.core.aggregation.AccumulatorOperators.AbstractAggregationExpression#toDbObject(java.lang.Object, org.springframework.data.mongodb.core.aggregation.AggregationOperationContext)
465468
*/
466469
@Override
470+
@SuppressWarnings("unchecked")
467471
public DBObject toDbObject(Object value, AggregationOperationContext context) {
468472

469473
if (value instanceof List) {
@@ -543,9 +547,10 @@ public StdDevPop and(AggregationExpression expression) {
543547
}
544548

545549
/* (non-Javadoc)
546-
* @see org.springframework.data.mongodb.core.aggregation.AggregationExpressions.AbstractAggregationExpression#toDbObject(java.lang.Object, org.springframework.data.mongodb.core.aggregation.AggregationOperationContext)
550+
* @see org.springframework.data.mongodb.core.aggregation.AccumulatorOperators.AbstractAggregationExpression#toDbObject(java.lang.Object, org.springframework.data.mongodb.core.aggregation.AggregationOperationContext)
547551
*/
548552
@Override
553+
@SuppressWarnings("unchecked")
549554
public DBObject toDbObject(Object value, AggregationOperationContext context) {
550555

551556
if (value instanceof List) {
@@ -625,9 +630,10 @@ public StdDevSamp and(AggregationExpression expression) {
625630
}
626631

627632
/* (non-Javadoc)
628-
* @see org.springframework.data.mongodb.core.aggregation.AggregationExpressions.AbstractAggregationExpression#toDbObject(java.lang.Object, org.springframework.data.mongodb.core.aggregation.AggregationOperationContext)
633+
* @see org.springframework.data.mongodb.core.aggregation.AccumulatorOperators.AbstractAggregationExpression#toDbObject(java.lang.Object, org.springframework.data.mongodb.core.aggregation.AggregationOperationContext)
629634
*/
630635
@Override
636+
@SuppressWarnings("unchecked")
631637
public DBObject toDbObject(Object value, AggregationOperationContext context) {
632638

633639
if (value instanceof List) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* @author Oliver Gierke
3232
* @author Christoph Strobl
3333
* @since 1.7
34-
* @deprecated since 1.10. Please use {@link AggregationExpressions} instead.
34+
* @deprecated since 1.10. Please use {@link ArithmeticOperators} and {@link ComparisonOperators} instead.
3535
*/
3636
@Deprecated
3737
public enum AggregationFunctionExpressions {

0 commit comments

Comments
 (0)