Skip to content

Commit 22fd062

Browse files
authored
Renamed Computation interfaces / classes (#979)
Renamed to closer match the documentation terminology for the fields. JAVA-4665
1 parent a31131f commit 22fd062

23 files changed

+519
-517
lines changed

driver-core/src/main/com/mongodb/client/model/Aggregates.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import com.mongodb.MongoNamespace;
2020
import com.mongodb.client.model.densify.DensifyOptions;
2121
import com.mongodb.client.model.densify.DensifyRange;
22-
import com.mongodb.client.model.fill.FillComputation;
22+
import com.mongodb.client.model.fill.FillOutputField;
2323
import com.mongodb.client.model.fill.FillOptions;
2424
import com.mongodb.client.model.search.SearchOperator;
2525
import com.mongodb.client.model.search.SearchCollector;
@@ -624,16 +624,16 @@ public static Bson sample(final int size) {
624624
* Sorting is required by certain functions and may be required by some windows (see {@link Windows} for more details).
625625
* Sorting is used only for the purpose of computing window functions and does not guarantee ordering
626626
* of the output documents.
627-
* @param output A {@linkplain WindowedComputation windowed computation}.
628-
* @param moreOutput More {@linkplain WindowedComputation windowed computations}.
627+
* @param output A {@linkplain WindowOutputField windowed computation}.
628+
* @param moreOutput More {@linkplain WindowOutputField windowed computations}.
629629
* @param <TExpression> The {@code partitionBy} expression type.
630630
* @return The {@code $setWindowFields} pipeline stage.
631631
* @mongodb.driver.dochub core/window-functions-set-window-fields $setWindowFields
632632
* @mongodb.server.release 5.0
633633
* @since 4.3
634634
*/
635635
public static <TExpression> Bson setWindowFields(@Nullable final TExpression partitionBy, @Nullable final Bson sortBy,
636-
final WindowedComputation output, final WindowedComputation... moreOutput) {
636+
final WindowOutputField output, final WindowOutputField... moreOutput) {
637637
return setWindowFields(partitionBy, sortBy, concat(notNull("output", output), moreOutput));
638638
}
639639

@@ -650,7 +650,7 @@ public static <TExpression> Bson setWindowFields(@Nullable final TExpression par
650650
* Sorting is required by certain functions and may be required by some windows (see {@link Windows} for more details).
651651
* Sorting is used only for the purpose of computing window functions and does not guarantee ordering
652652
* of the output documents.
653-
* @param output A list of {@linkplain WindowedComputation windowed computations}.
653+
* @param output A list of {@linkplain WindowOutputField windowed computations}.
654654
* Specifying an empty list is not an error, but the resulting stage does not do anything useful.
655655
* @param <TExpression> The {@code partitionBy} expression type.
656656
* @return The {@code $setWindowFields} pipeline stage.
@@ -659,7 +659,7 @@ public static <TExpression> Bson setWindowFields(@Nullable final TExpression par
659659
* @since 4.3
660660
*/
661661
public static <TExpression> Bson setWindowFields(@Nullable final TExpression partitionBy, @Nullable final Bson sortBy,
662-
final Iterable<? extends WindowedComputation> output) {
662+
final Iterable<? extends WindowOutputField> output) {
663663
notNull("output", output);
664664
return new SetWindowFieldsStage<>(partitionBy, sortBy, output);
665665
}
@@ -722,28 +722,28 @@ public String toString() {
722722
* Creates a {@code $fill} pipeline stage, which assigns values to fields when they are {@link BsonType#NULL Null} or missing.
723723
*
724724
* @param options The fill options.
725-
* @param output The {@link FillComputation}.
726-
* @param moreOutput More {@link FillComputation}s.
725+
* @param output The {@link FillOutputField}.
726+
* @param moreOutput More {@link FillOutputField}s.
727727
* @return The requested pipeline stage.
728728
* @mongodb.driver.manual reference/operator/aggregation/fill/ $fill
729729
* @mongodb.server.release 5.3
730730
* @since 4.7
731731
*/
732-
public static Bson fill(final FillOptions options, final FillComputation output, final FillComputation... moreOutput) {
732+
public static Bson fill(final FillOptions options, final FillOutputField output, final FillOutputField... moreOutput) {
733733
return fill(options, concat(notNull("output", output), moreOutput));
734734
}
735735

736736
/**
737737
* Creates a {@code $fill} pipeline stage, which assigns values to fields when they are {@link BsonType#NULL Null} or missing.
738738
*
739739
* @param options The fill options.
740-
* @param output The non-empty {@link FillComputation}s.
740+
* @param output The non-empty {@link FillOutputField}s.
741741
* @return The requested pipeline stage.
742742
* @mongodb.driver.manual reference/operator/aggregation/fill/ $fill
743743
* @mongodb.server.release 5.3
744744
* @since 4.7
745745
*/
746-
public static Bson fill(final FillOptions options, final Iterable<? extends FillComputation> output) {
746+
public static Bson fill(final FillOptions options, final Iterable<? extends FillOutputField> output) {
747747
notNull("options", options);
748748
notNull("output", output);
749749
isTrueArgument("output must not be empty", sizeAtLeast(output, 1));
@@ -753,7 +753,7 @@ public <TDocument> BsonDocument toBsonDocument(final Class<TDocument> documentCl
753753
BsonDocument fillSpecificationDoc = new BsonDocument();
754754
fillSpecificationDoc.putAll(options.toBsonDocument(documentClass, codecRegistry));
755755
BsonDocument outputDoc = new BsonDocument();
756-
for (final FillComputation computation : output) {
756+
for (final FillOutputField computation : output) {
757757
BsonDocument computationDoc = computation.toBsonDocument(documentClass, codecRegistry);
758758
assertTrue(computationDoc.size() == 1);
759759
outputDoc.putAll(computationDoc);
@@ -1821,12 +1821,12 @@ private static final class SetWindowFieldsStage<TExpression> implements Bson {
18211821
private final TExpression partitionBy;
18221822
@Nullable
18231823
private final Bson sortBy;
1824-
private final Iterable<? extends WindowedComputation> output;
1824+
private final Iterable<? extends WindowOutputField> output;
18251825

18261826
SetWindowFieldsStage(
18271827
@Nullable final TExpression partitionBy,
18281828
@Nullable final Bson sortBy,
1829-
final Iterable<? extends WindowedComputation> output) {
1829+
final Iterable<? extends WindowOutputField> output) {
18301830
this.partitionBy = partitionBy;
18311831
this.sortBy = sortBy;
18321832
this.output = output;
@@ -1846,8 +1846,8 @@ public <TDocument> BsonDocument toBsonDocument(final Class<TDocument> tDocumentC
18461846
BuildersHelper.encodeValue(writer, sortBy, codecRegistry);
18471847
}
18481848
writer.writeStartDocument("output");
1849-
for (WindowedComputation windowedComputation : output) {
1850-
BsonField field = windowedComputation.toBsonField();
1849+
for (WindowOutputField windowOutputField : output) {
1850+
BsonField field = windowOutputField.toBsonField();
18511851
writer.writeName(field.getName());
18521852
BuildersHelper.encodeValue(writer, field.getValue(), codecRegistry);
18531853
}

driver-core/src/main/com/mongodb/client/model/MongoTimeUnit.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* Units for specifying time-based values.
2323
*
2424
* @see Windows
25-
* @see WindowedComputations
25+
* @see WindowOutputFields
2626
* @see DensifyRange
2727
* @mongodb.server.release 5.0
2828
* @since 4.3

driver-core/src/main/com/mongodb/client/model/WindowedComputation.java renamed to driver-core/src/main/com/mongodb/client/model/WindowOutputField.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
* The core part of the {@link Aggregates#setWindowFields(Object, Bson, Iterable) $setWindowFields} pipeline stage of an aggregation pipeline.
2222
* A triple of a window function, a {@linkplain Window window} and a path to a field to be computed by the window function over the window.
2323
*
24-
* @see WindowedComputations
24+
* @see WindowOutputFields
2525
* @since 4.3
2626
*/
27-
public interface WindowedComputation {
27+
public interface WindowOutputField {
2828
/**
2929
* Render into {@link BsonField}.
3030
*

0 commit comments

Comments
 (0)