2121import java .util .stream .Stream ;
2222
2323import org .bson .Document ;
24-
2524import org .springframework .data .domain .Pageable ;
2625import org .springframework .data .domain .SliceImpl ;
2726import org .springframework .data .mongodb .InvalidMongoDbApiUsageException ;
2827import org .springframework .data .mongodb .core .MongoOperations ;
2928import org .springframework .data .mongodb .core .aggregation .Aggregation ;
30- import org .springframework .data .mongodb .core .aggregation .AggregationOperation ;
3129import org .springframework .data .mongodb .core .aggregation .AggregationOptions ;
3230import org .springframework .data .mongodb .core .aggregation .AggregationPipeline ;
33- import org .springframework .data .mongodb .core .aggregation .AggregationOptions .Builder ;
3431import org .springframework .data .mongodb .core .aggregation .AggregationResults ;
3532import org .springframework .data .mongodb .core .aggregation .TypedAggregation ;
3633import org .springframework .data .mongodb .core .convert .MongoConverter ;
4239import org .springframework .expression .ExpressionParser ;
4340import org .springframework .lang .Nullable ;
4441import org .springframework .util .ClassUtils ;
45- import org .springframework .util .CollectionUtils ;
46- import org .springframework .util .ObjectUtils ;
4742
4843/**
4944 * {@link AbstractMongoQuery} implementation to run string-based aggregations using
@@ -66,8 +61,8 @@ public class StringBasedAggregation extends AbstractMongoQuery {
6661 *
6762 * @param method must not be {@literal null}.
6863 * @param mongoOperations must not be {@literal null}.
69- * @param expressionParser
70- * @param evaluationContextProvider
64+ * @param expressionParser must not be {@literal null}.
65+ * @param evaluationContextProvider must not be {@literal null}.
7166 */
7267 public StringBasedAggregation (MongoQueryMethod method , MongoOperations mongoOperations ,
7368 ExpressionParser expressionParser , QueryMethodEvaluationContextProvider evaluationContextProvider ) {
@@ -85,10 +80,6 @@ public StringBasedAggregation(MongoQueryMethod method, MongoOperations mongoOper
8580 this .evaluationContextProvider = evaluationContextProvider ;
8681 }
8782
88- /*
89- * (non-Javascript)
90- * @see org.springframework.data.mongodb.repository.query.AbstractReactiveMongoQuery#doExecute(org.springframework.data.mongodb.repository.query.MongoQueryMethod, org.springframework.data.repository.query.ResultProcessor, org.springframework.data.mongodb.repository.query.ConvertingParameterAccessor, java.lang.Class)
91- */
9283 @ Override
9384 @ Nullable
9485 protected Object doExecute (MongoQueryMethod method , ResultProcessor resultProcessor ,
@@ -133,7 +124,7 @@ protected Object doExecute(MongoQueryMethod method, ResultProcessor resultProces
133124 }
134125
135126 AggregationResults <Object > result = (AggregationResults <Object >) mongoOperations .aggregate (aggregation , targetType );
136- if (ReflectionUtils .isVoid (typeToRead )) {
127+ if (ReflectionUtils .isVoid (typeToRead )) {
137128 return null ;
138129 }
139130
@@ -181,61 +172,42 @@ AggregationPipeline computePipeline(MongoQueryMethod method, ConvertingParameter
181172 return new AggregationPipeline (parseAggregationPipeline (method .getAnnotatedAggregation (), accessor ));
182173 }
183174
184- private AggregationOptions computeOptions (MongoQueryMethod method , ConvertingParameterAccessor accessor , AggregationPipeline pipeline ) {
175+ private AggregationOptions computeOptions (MongoQueryMethod method , ConvertingParameterAccessor accessor ,
176+ AggregationPipeline pipeline ) {
185177
186178 AggregationOptions .Builder builder = Aggregation .newAggregationOptions ();
187179
188180 AggregationUtils .applyCollation (builder , method .getAnnotatedCollation (), accessor , method .getParameters (),
189181 expressionParser , evaluationContextProvider );
190182 AggregationUtils .applyMeta (builder , method );
191183
192- if (ReflectionUtils .isVoid (method .getReturnType ().getType ()) && pipeline .isOutOrMerge ()) {
184+ if (ReflectionUtils .isVoid (method .getReturnType ().getType ()) && pipeline .isOutOrMerge ()) {
193185 builder .skipOutput ();
194186 }
195187
196188 return builder .build ();
197189 }
198190
199- /*
200- * (non-Javascript)
201- * @see org.springframework.data.mongodb.repository.query.AbstractMongoQuery#createQuery(org.springframework.data.mongodb.repository.query.ConvertingParameterAccessor)
202- */
203191 @ Override
204192 protected Query createQuery (ConvertingParameterAccessor accessor ) {
205193 throw new UnsupportedOperationException ("No query support for aggregation" );
206194 }
207195
208- /*
209- * (non-Javascript)
210- * @see org.springframework.data.mongodb.repository.query.AbstractMongoQuery#isCountQuery()
211- */
212196 @ Override
213197 protected boolean isCountQuery () {
214198 return false ;
215199 }
216200
217- /*
218- * (non-Javascript)
219- * @see org.springframework.data.mongodb.repository.query.AbstractMongoQuery#isExistsQuery()
220- */
221201 @ Override
222202 protected boolean isExistsQuery () {
223203 return false ;
224204 }
225205
226- /*
227- * (non-Javascript)
228- * @see org.springframework.data.mongodb.repository.query.AbstractMongoQuery#isDeleteQuery()
229- */
230206 @ Override
231207 protected boolean isDeleteQuery () {
232208 return false ;
233209 }
234210
235- /*
236- * (non-Javascript)
237- * @see org.springframework.data.mongodb.repository.query.AbstractMongoQuery#isLimiting()
238- */
239211 @ Override
240212 protected boolean isLimiting () {
241213 return false ;
0 commit comments