Skip to content

Commit 7584798

Browse files
committed
DATAMONGO-2312 - Polishing.
Add Javadoc comments. Original pull request: #770.
1 parent 0e32b73 commit 7584798

File tree

1 file changed

+34
-2
lines changed

1 file changed

+34
-2
lines changed

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

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import java.util.stream.Collectors;
2424

2525
import org.bson.Document;
26-
2726
import org.springframework.data.mongodb.core.aggregation.ConditionalOperators.Cond;
2827
import org.springframework.data.mongodb.core.aggregation.ConditionalOperators.IfNull;
2928
import org.springframework.data.mongodb.core.aggregation.ExposedFields.ExposedField;
@@ -1549,7 +1548,8 @@ OperationProjection withAlias(String alias) {
15491548
final Field aliasedField = Fields.field(alias, this.field.getName());
15501549
return new OperationProjection(aliasedField, operation, values.toArray()) {
15511550

1552-
/* (non-Javadoc)
1551+
/*
1552+
* (non-Javadoc)
15531553
* @see org.springframework.data.mongodb.core.aggregation.ProjectionOperation.ProjectionOperationBuilder.OperationProjection#getField()
15541554
*/
15551555
@Override
@@ -1749,6 +1749,10 @@ public ExpressionProjection(Field field, AggregationExpression expression) {
17491749
this.expression = expression;
17501750
}
17511751

1752+
/*
1753+
* (non-Javadoc)
1754+
* @see org.springframework.data.mongodb.core.aggregation.ProjectionOperation.Projection#toDocument(org.springframework.data.mongodb.core.aggregation.AggregationOperationContext)
1755+
*/
17521756
@Override
17531757
public Document toDocument(AggregationOperationContext context) {
17541758
return new Document(field.getName(), expression.toDocument(context));
@@ -1788,6 +1792,8 @@ public Document toDocument(AggregationOperationContext context) {
17881792
}
17891793

17901794
/**
1795+
* Builder for {@code array} projections.
1796+
*
17911797
* @author Christoph Strobl
17921798
* @since 2.2
17931799
*/
@@ -1802,18 +1808,40 @@ public ArrayProjectionOperationBuilder(ProjectionOperation target) {
18021808
this.projections = new ArrayList<>();
18031809
}
18041810

1811+
/**
1812+
* Creates a new {@link ArrayProjectionOperationBuilder} with the current {@link Projection}s and the given one.
1813+
*
1814+
* @param expression
1815+
* @return
1816+
*/
18051817
public ArrayProjectionOperationBuilder and(AggregationExpression expression) {
18061818

1819+
Assert.notNull(expression, "AggregationExpression must not be null!");
1820+
18071821
this.projections.add(expression);
18081822
return this;
18091823
}
18101824

1825+
/**
1826+
* Creates a new {@link ArrayProjectionOperationBuilder} with the current {@link Projection}s and the given one.
1827+
*
1828+
* @param field
1829+
* @return
1830+
*/
18111831
public ArrayProjectionOperationBuilder and(Field field) {
18121832

1833+
Assert.notNull(field, "Field must not be null!");
1834+
18131835
this.projections.add(field);
18141836
return this;
18151837
}
18161838

1839+
/**
1840+
* Creates a new {@link ArrayProjectionOperationBuilder} with the current {@link Projection}s and the given one.
1841+
*
1842+
* @param value
1843+
* @return
1844+
*/
18171845
public ArrayProjectionOperationBuilder and(Object value) {
18181846

18191847
this.projections.add(value);
@@ -1849,6 +1877,10 @@ public ArrayProjection(Field targetField, List<Object> projections) {
18491877
this.projections = projections;
18501878
}
18511879

1880+
/*
1881+
* (non-Javadoc)
1882+
* @see org.springframework.data.mongodb.core.aggregation.ProjectionOperation.Projection#toDocument(org.springframework.data.mongodb.core.aggregation.AggregationOperationContext)
1883+
*/
18521884
@Override
18531885
public Document toDocument(AggregationOperationContext context) {
18541886

0 commit comments

Comments
 (0)