23
23
import java .util .*;
24
24
import java .util .concurrent .TimeUnit ;
25
25
import java .util .function .BiPredicate ;
26
- import java .util .function .Supplier ;
27
26
import java .util .stream .Collectors ;
28
27
import java .util .stream .Stream ;
29
28
30
29
import org .apache .commons .logging .Log ;
31
30
import org .apache .commons .logging .LogFactory ;
32
31
import org .bson .Document ;
33
32
import org .bson .conversions .Bson ;
33
+
34
34
import org .springframework .beans .BeansException ;
35
35
import org .springframework .context .ApplicationContext ;
36
36
import org .springframework .context .ApplicationContextAware ;
@@ -1870,21 +1870,21 @@ public <T> List<T> mapReduce(Query query, Class<?> domainType, String inputColle
1870
1870
1871
1871
@ Override
1872
1872
public <O > AggregationResults <O > aggregate (TypedAggregation <?> aggregation , Class <O > outputType ) {
1873
+
1874
+ Assert .notNull (aggregation , "Aggregation pipeline must not be null" );
1873
1875
return aggregate (aggregation , getCollectionName (aggregation .getInputType ()), outputType );
1874
1876
}
1875
1877
1876
1878
@ Override
1877
1879
public <O > AggregationResults <O > aggregate (TypedAggregation <?> aggregation , String inputCollectionName ,
1878
1880
Class <O > outputType ) {
1879
-
1880
- Assert .notNull (aggregation , "Aggregation pipeline must not be null" );
1881
-
1882
1881
return aggregate (aggregation , inputCollectionName , outputType , null );
1883
1882
}
1884
1883
1885
1884
@ Override
1886
1885
public <O > AggregationResults <O > aggregate (Aggregation aggregation , Class <?> inputType , Class <O > outputType ) {
1887
1886
1887
+ Assert .notNull (aggregation , "Aggregation pipeline must not be null" );
1888
1888
return aggregate (aggregation , getCollectionName (inputType ), outputType ,
1889
1889
queryOperations .createAggregation (aggregation , inputType ).getAggregationOperationContext ());
1890
1890
}
@@ -1897,19 +1897,20 @@ public <O> AggregationResults<O> aggregate(Aggregation aggregation, String colle
1897
1897
@ Override
1898
1898
public <O > Stream <O > aggregateStream (TypedAggregation <?> aggregation , String inputCollectionName ,
1899
1899
Class <O > outputType ) {
1900
-
1901
- Assert .notNull (aggregation , "Aggregation pipeline must not be null" );
1902
1900
return aggregateStream (aggregation , inputCollectionName , outputType , null );
1903
1901
}
1904
1902
1905
1903
@ Override
1906
1904
public <O > Stream <O > aggregateStream (TypedAggregation <?> aggregation , Class <O > outputType ) {
1905
+
1906
+ Assert .notNull (aggregation , "Aggregation pipeline must not be null" );
1907
1907
return aggregateStream (aggregation , getCollectionName (aggregation .getInputType ()), outputType );
1908
1908
}
1909
1909
1910
1910
@ Override
1911
1911
public <O > Stream <O > aggregateStream (Aggregation aggregation , Class <?> inputType , Class <O > outputType ) {
1912
1912
1913
+ Assert .notNull (aggregation , "Aggregation pipeline must not be null" );
1913
1914
return aggregateStream (aggregation , getCollectionName (inputType ), outputType ,
1914
1915
queryOperations .createAggregation (aggregation , inputType ).getAggregationOperationContext ());
1915
1916
}
@@ -2056,8 +2057,8 @@ protected <O> AggregationResults<O> doAggregate(Aggregation aggregation, String
2056
2057
protected <O > Stream <O > aggregateStream (Aggregation aggregation , String collectionName , Class <O > outputType ,
2057
2058
@ Nullable AggregationOperationContext context ) {
2058
2059
2059
- Assert .hasText (collectionName , "Collection name must not be null or empty" );
2060
2060
Assert .notNull (aggregation , "Aggregation pipeline must not be null" );
2061
+ Assert .hasText (collectionName , "Collection name must not be null or empty" );
2061
2062
Assert .notNull (outputType , "Output type must not be null" );
2062
2063
Assert .isTrue (!aggregation .getOptions ().isExplain (), "Can't use explain option with streaming" );
2063
2064
0 commit comments