|
|
|
@ -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() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
return initialValue -> (usesFieldRef() ? Reduce.arrayOf(fieldReference) : Reduce.arrayOf(expression)) |
|
|
|
public Reduce startingWith(Object initialValue) { |
|
|
|
.withInitialValue(initialValue).reduce(expressions); |
|
|
|
return (usesFieldRef() ? Reduce.arrayOf(fieldReference) : Reduce.arrayOf(expression)) |
|
|
|
|
|
|
|
.withInitialValue(initialValue).reduce(expressions); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
|