Skip to content

Commit 646b525

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

File tree

14 files changed

+212
-198
lines changed

14 files changed

+212
-198
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public Document toDocument(AggregationOperationContext context) {
4444
return toDocument(this.value, context);
4545
}
4646

47+
@SuppressWarnings("unchecked")
4748
public Document toDocument(Object value, AggregationOperationContext context) {
4849

4950
Object valueToUse;
@@ -79,6 +80,7 @@ protected static List<Field> asFields(String... fieldRefs) {
7980
return Fields.fields(fieldRefs).asList();
8081
}
8182

83+
@SuppressWarnings("unchecked")
8284
private Object unpack(Object value, AggregationOperationContext context) {
8385

8486
if (value instanceof AggregationExpression) {
@@ -122,13 +124,13 @@ protected List<Object> append(Object value) {
122124
return Arrays.asList(this.value, value);
123125
}
124126

127+
@SuppressWarnings("unchecked")
125128
protected java.util.Map<String, Object> append(String key, Object value) {
126129

127130
if (!(this.value instanceof java.util.Map)) {
128131
throw new IllegalArgumentException("o_O");
129132
}
130-
java.util.Map<String, Object> clone = new LinkedHashMap<String, Object>(
131-
(java.util.Map<String, Object>) this.value);
133+
java.util.Map<String, Object> clone = new LinkedHashMap<String, Object>((java.util.Map<String, Object>) this.value);
132134
clone.put(key, value);
133135
return clone;
134136

@@ -142,7 +144,7 @@ protected List<Object> values() {
142144
if (value instanceof java.util.Map) {
143145
return new ArrayList<Object>(((java.util.Map) value).values());
144146
}
145-
return new ArrayList<Object>(Arrays.asList(value));
147+
return new ArrayList<Object>(Collections.singletonList(value));
146148
}
147149

148150
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
@@ -43,7 +43,7 @@ public static AccumulatorOperatorFactory valueOf(String fieldReference) {
4343
/**
4444
* Take the numeric value referenced resulting from given {@link AggregationExpression}.
4545
*
46-
* @param fieldReference must not be {@literal null}.
46+
* @param expression must not be {@literal null}.
4747
* @return
4848
*/
4949
public static AccumulatorOperatorFactory valueOf(AggregationExpression expression) {
@@ -71,7 +71,7 @@ public AccumulatorOperatorFactory(String fieldReference) {
7171
}
7272

7373
/**
74-
* Creates new {@link ArrayOperatorFactory} for given {@link AggregationExpression}.
74+
* Creates new {@link AccumulatorOperatorFactory} for given {@link AggregationExpression}.
7575
*
7676
* @param expression must not be {@literal null}.
7777
*/
@@ -83,7 +83,7 @@ public AccumulatorOperatorFactory(AggregationExpression expression) {
8383
}
8484

8585
/**
86-
* Creates new {@link AggregationExpressions} that takes the associated numeric value expression and calculates and
86+
* Creates new {@link AggregationExpression} that takes the associated numeric value expression and calculates and
8787
* returns the sum.
8888
*
8989
* @return
@@ -93,7 +93,7 @@ public Sum sum() {
9393
}
9494

9595
/**
96-
* Creates new {@link AggregationExpressions} that takes the associated numeric value expression and returns the
96+
* Creates new {@link AggregationExpression} that takes the associated numeric value expression and returns the
9797
* average value.
9898
*
9999
* @return
@@ -103,7 +103,7 @@ public Avg avg() {
103103
}
104104

105105
/**
106-
* Creates new {@link AggregationExpressions} that takes the associated numeric value expression and returns the
106+
* Creates new {@link AggregationExpression} that takes the associated numeric value expression and returns the
107107
* maximum value.
108108
*
109109
* @return
@@ -113,7 +113,7 @@ public Max max() {
113113
}
114114

115115
/**
116-
* Creates new {@link AggregationExpressions} that takes the associated numeric value expression and returns the
116+
* Creates new {@link AggregationExpression} that takes the associated numeric value expression and returns the
117117
* minimum value.
118118
*
119119
* @return
@@ -123,7 +123,7 @@ public Min min() {
123123
}
124124

125125
/**
126-
* Creates new {@link AggregationExpressions} that takes the associated numeric value expression and calculates the
126+
* Creates new {@link AggregationExpression} that takes the associated numeric value expression and calculates the
127127
* population standard deviation of the input values.
128128
*
129129
* @return
@@ -133,7 +133,7 @@ public StdDevPop stdDevPop() {
133133
}
134134

135135
/**
136-
* Creates new {@link AggregationExpressions} that takes the associated numeric value expression and calculates the
136+
* Creates new {@link AggregationExpression} that takes the associated numeric value expression and calculates the
137137
* sample standard deviation of the input values.
138138
*
139139
* @return
@@ -214,9 +214,10 @@ public Sum and(AggregationExpression expression) {
214214
}
215215

216216
/* (non-Javadoc)
217-
* @see org.springframework.data.mongodb.core.aggregation.AggregationExpressions.AbstractAggregationExpression#toDocument(java.lang.Object, org.springframework.data.mongodb.core.aggregation.AggregationOperationContext)
217+
* @see org.springframework.data.mongodb.core.aggregation.AccumulatorOperators.AbstractAggregationExpression#toDocument(java.lang.Object, org.springframework.data.mongodb.core.aggregation.AggregationOperationContext)
218218
*/
219219
@Override
220+
@SuppressWarnings("unchecked")
220221
public Document toDocument(Object value, AggregationOperationContext context) {
221222

222223
if (value instanceof List) {
@@ -296,9 +297,10 @@ public Avg and(AggregationExpression expression) {
296297
}
297298

298299
/* (non-Javadoc)
299-
* @see org.springframework.data.mongodb.core.aggregation.AggregationExpressions.AbstractAggregationExpression#toDocument(java.lang.Object, org.springframework.data.mongodb.core.aggregation.AggregationOperationContext)
300+
* @see org.springframework.data.mongodb.core.aggregation.AccumulatorOperators.AbstractAggregationExpression#toDocument(java.lang.Object, org.springframework.data.mongodb.core.aggregation.AggregationOperationContext)
300301
*/
301302
@Override
303+
@SuppressWarnings("unchecked")
302304
public Document toDocument(Object value, AggregationOperationContext context) {
303305

304306
if (value instanceof List) {
@@ -378,9 +380,10 @@ public Max and(AggregationExpression expression) {
378380
}
379381

380382
/* (non-Javadoc)
381-
* @see org.springframework.data.mongodb.core.aggregation.AggregationExpressions.AbstractAggregationExpression#toDocument(java.lang.Object, org.springframework.data.mongodb.core.aggregation.AggregationOperationContext)
383+
* @see org.springframework.data.mongodb.core.aggregation.AccumulatorOperators.AbstractAggregationExpression#toDocument(java.lang.Object, org.springframework.data.mongodb.core.aggregation.AggregationOperationContext)
382384
*/
383385
@Override
386+
@SuppressWarnings("unchecked")
384387
public Document toDocument(Object value, AggregationOperationContext context) {
385388

386389
if (value instanceof List) {
@@ -460,9 +463,10 @@ public Min and(AggregationExpression expression) {
460463
}
461464

462465
/* (non-Javadoc)
463-
* @see org.springframework.data.mongodb.core.aggregation.AggregationExpressions.AbstractAggregationExpression#toDocument(java.lang.Object, org.springframework.data.mongodb.core.aggregation.AggregationOperationContext)
466+
* @see org.springframework.data.mongodb.core.aggregation.AccumulatorOperators.AbstractAggregationExpression#toDocument(java.lang.Object, org.springframework.data.mongodb.core.aggregation.AggregationOperationContext)
464467
*/
465468
@Override
469+
@SuppressWarnings("unchecked")
466470
public Document toDocument(Object value, AggregationOperationContext context) {
467471

468472
if (value instanceof List) {
@@ -542,9 +546,10 @@ public StdDevPop and(AggregationExpression expression) {
542546
}
543547

544548
/* (non-Javadoc)
545-
* @see org.springframework.data.mongodb.core.aggregation.AggregationExpressions.AbstractAggregationExpression#toDocument(java.lang.Object, org.springframework.data.mongodb.core.aggregation.AggregationOperationContext)
549+
* @see org.springframework.data.mongodb.core.aggregation.AccumulatorOperators.AbstractAggregationExpression#toDocument(java.lang.Object, org.springframework.data.mongodb.core.aggregation.AggregationOperationContext)
546550
*/
547551
@Override
552+
@SuppressWarnings("unchecked")
548553
public Document toDocument(Object value, AggregationOperationContext context) {
549554

550555
if (value instanceof List) {
@@ -624,9 +629,10 @@ public StdDevSamp and(AggregationExpression expression) {
624629
}
625630

626631
/* (non-Javadoc)
627-
* @see org.springframework.data.mongodb.core.aggregation.AggregationExpressions.AbstractAggregationExpression#toDocument(java.lang.Object, org.springframework.data.mongodb.core.aggregation.AggregationOperationContext)
632+
* @see org.springframework.data.mongodb.core.aggregation.AccumulatorOperators.AbstractAggregationExpression#toDocument(java.lang.Object, org.springframework.data.mongodb.core.aggregation.AggregationOperationContext)
628633
*/
629634
@Override
635+
@SuppressWarnings("unchecked")
630636
public Document toDocument(Object value, AggregationOperationContext context) {
631637

632638
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
@@ -30,7 +30,7 @@
3030
* @author Christoph Strobl
3131
* @author Mark Paluch
3232
* @since 1.7
33-
* @deprecated since 1.10. Please use {@link AggregationExpressions} instead.
33+
* @deprecated since 1.10. Please use {@link ArithmeticOperators} and {@link ComparisonOperators} instead.
3434
*/
3535
@Deprecated
3636
public enum AggregationFunctionExpressions {

0 commit comments

Comments
 (0)