DATAMONGO-1843 - Polishing.
Convert anonymous classes to lambdas. Typo fixes. Migrate test to AssertJ. Original pull request: #526.
This commit is contained in:
@@ -32,6 +32,7 @@ import org.springframework.util.Assert;
|
|||||||
* Gateway to {@literal array} aggregation operations.
|
* Gateway to {@literal array} aggregation operations.
|
||||||
*
|
*
|
||||||
* @author Christoph Strobl
|
* @author Christoph Strobl
|
||||||
|
* @author Mark Paluch
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
public class ArrayOperators {
|
public class ArrayOperators {
|
||||||
@@ -224,15 +225,10 @@ public class ArrayOperators {
|
|||||||
* @param expression must not be {@literal null}.
|
* @param expression must not be {@literal null}.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public ArrayOperatorFactory.ReduceInitialValueBuilder reduce(final AggregationExpression expression) {
|
public ArrayOperatorFactory.ReduceInitialValueBuilder reduce(AggregationExpression expression) {
|
||||||
return new ArrayOperatorFactory.ReduceInitialValueBuilder() {
|
|
||||||
|
|
||||||
@Override
|
return initialValue -> (usesFieldRef() ? Reduce.arrayOf(fieldReference)
|
||||||
public Reduce startingWith(Object initialValue) {
|
: Reduce.arrayOf(ArrayOperatorFactory.this.expression)).withInitialValue(initialValue).reduce(expression);
|
||||||
return (usesFieldRef() ? Reduce.arrayOf(fieldReference)
|
|
||||||
: Reduce.arrayOf(ArrayOperatorFactory.this.expression)).withInitialValue(initialValue).reduce(expression);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -242,16 +238,10 @@ public class ArrayOperators {
|
|||||||
* @param expressions
|
* @param expressions
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public ArrayOperatorFactory.ReduceInitialValueBuilder reduce(final PropertyExpression... expressions) {
|
public ArrayOperatorFactory.ReduceInitialValueBuilder reduce(PropertyExpression... expressions) {
|
||||||
|
|
||||||
return new ArrayOperatorFactory.ReduceInitialValueBuilder() {
|
return initialValue -> (usesFieldRef() ? Reduce.arrayOf(fieldReference) : Reduce.arrayOf(expression))
|
||||||
|
.withInitialValue(initialValue).reduce(expressions);
|
||||||
@Override
|
|
||||||
public Reduce startingWith(Object initialValue) {
|
|
||||||
return (usesFieldRef() ? Reduce.arrayOf(fieldReference) : Reduce.arrayOf(expression))
|
|
||||||
.withInitialValue(initialValue).reduce(expressions);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
522
spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/ProjectionOperationUnitTests.java
Normal file → Executable file
522
spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/ProjectionOperationUnitTests.java
Normal file → Executable file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user