Skip to content

Commit 441bc53

Browse files
committed
Rename to Mql (automated) (#1073)
JAVA-3879
1 parent 678cef8 commit 441bc53

34 files changed

+830
-830
lines changed

driver-core/src/main/com/mongodb/MongoClientSettings.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import com.mongodb.annotations.Immutable;
2020
import com.mongodb.annotations.NotThreadSafe;
2121
import com.mongodb.client.gridfs.codecs.GridFSFileCodecProvider;
22-
import com.mongodb.client.model.expressions.ExpressionCodecProvider;
22+
import com.mongodb.client.model.mql.ExpressionCodecProvider;
2323
import com.mongodb.client.model.geojson.codecs.GeoJsonCodecProvider;
2424
import com.mongodb.connection.ClusterSettings;
2525
import com.mongodb.connection.ConnectionPoolSettings;

driver-core/src/main/com/mongodb/client/model/expressions/Branches.java renamed to driver-core/src/main/com/mongodb/client/model/mql/Branches.java

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.mongodb.client.model.expressions;
17+
package com.mongodb.client.model.mql;
1818

1919
import com.mongodb.annotations.Beta;
2020
import com.mongodb.assertions.Assertions;
@@ -23,10 +23,10 @@
2323
import java.util.List;
2424
import java.util.function.Function;
2525

26-
import static com.mongodb.client.model.expressions.MqlUnchecked.Unchecked.TYPE_ARGUMENT;
26+
import static com.mongodb.client.model.mql.MqlUnchecked.Unchecked.TYPE_ARGUMENT;
2727

2828
/**
29-
* Branches are used in {@linkplain Expression#switchOn}, and
29+
* Branches are used in {@linkplain MqlValue#switchOn}, and
3030
* define a sequence of checks that will be performed. The first check
3131
* to succeed will produce the value that it specifies. If no check succeeds,
3232
* then the operation
@@ -37,18 +37,18 @@
3737
* @since 4.9.0
3838
*/
3939
@Beta(Beta.Reason.CLIENT)
40-
public final class Branches<T extends Expression> {
40+
public final class Branches<T extends MqlValue> {
4141

4242
Branches() {
4343
}
4444

45-
private static <T extends Expression, R extends Expression> BranchesIntermediary<T, R> with(final Function<T, SwitchCase<R>> switchCase) {
45+
private static <T extends MqlValue, R extends MqlValue> BranchesIntermediary<T, R> with(final Function<T, SwitchCase<R>> switchCase) {
4646
List<Function<T, SwitchCase<R>>> v = new ArrayList<>();
4747
v.add(switchCase);
4848
return new BranchesIntermediary<>(v);
4949
}
5050

51-
private static <T extends Expression> MqlExpression<?> mqlEx(final T value) {
51+
private static <T extends MqlValue> MqlExpression<?> mqlEx(final T value) {
5252
return (MqlExpression<?>) value;
5353
}
5454

@@ -63,7 +63,7 @@ private static <T extends Expression> MqlExpression<?> mqlEx(final T value) {
6363
* @param <R> the type of the produced value.
6464
* @return the appended sequence of checks.
6565
*/
66-
public <R extends Expression> BranchesIntermediary<T, R> is(final Function<? super T, BooleanExpression> predicate, final Function<? super T, ? extends R> mapping) {
66+
public <R extends MqlValue> BranchesIntermediary<T, R> is(final Function<? super T, MqlBoolean> predicate, final Function<? super T, ? extends R> mapping) {
6767
Assertions.notNull("predicate", predicate);
6868
Assertions.notNull("mapping", mapping);
6969
return with(value -> new SwitchCase<>(predicate.apply(value), mapping.apply(value)));
@@ -72,23 +72,23 @@ public <R extends Expression> BranchesIntermediary<T, R> is(final Function<? sup
7272
// eq lt lte
7373

7474
/**
75-
* A successful check for {@linkplain Expression#eq equality}
75+
* A successful check for {@linkplain MqlValue#eq equality}
7676
* produces a value specified by the {@code mapping}.
7777
*
7878
* @param v the value to check against.
7979
* @param mapping the mapping.
8080
* @param <R> the type of the produced value.
8181
* @return the appended sequence of checks.
8282
*/
83-
public <R extends Expression> BranchesIntermediary<T, R> eq(final T v, final Function<? super T, ? extends R> mapping) {
83+
public <R extends MqlValue> BranchesIntermediary<T, R> eq(final T v, final Function<? super T, ? extends R> mapping) {
8484
Assertions.notNull("v", v);
8585
Assertions.notNull("mapping", mapping);
8686
return is(value -> value.eq(v), mapping);
8787
}
8888

8989
/**
9090
* A successful check for being
91-
* {@linkplain Expression#lt less than}
91+
* {@linkplain MqlValue#lt less than}
9292
* the provided value {@code v}
9393
* produces a value specified by the {@code mapping}.
9494
*
@@ -97,15 +97,15 @@ public <R extends Expression> BranchesIntermediary<T, R> eq(final T v, final Fun
9797
* @param <R> the type of the produced value.
9898
* @return the appended sequence of checks.
9999
*/
100-
public <R extends Expression> BranchesIntermediary<T, R> lt(final T v, final Function<? super T, ? extends R> mapping) {
100+
public <R extends MqlValue> BranchesIntermediary<T, R> lt(final T v, final Function<? super T, ? extends R> mapping) {
101101
Assertions.notNull("v", v);
102102
Assertions.notNull("mapping", mapping);
103103
return is(value -> value.lt(v), mapping);
104104
}
105105

106106
/**
107107
* A successful check for being
108-
* {@linkplain Expression#lte less than or equal to}
108+
* {@linkplain MqlValue#lte less than or equal to}
109109
* the provided value {@code v}
110110
* produces a value specified by the {@code mapping}.
111111
*
@@ -114,7 +114,7 @@ public <R extends Expression> BranchesIntermediary<T, R> lt(final T v, final Fun
114114
* @param <R> the type of the produced value.
115115
* @return the appended sequence of checks.
116116
*/
117-
public <R extends Expression> BranchesIntermediary<T, R> lte(final T v, final Function<? super T, ? extends R> mapping) {
117+
public <R extends MqlValue> BranchesIntermediary<T, R> lte(final T v, final Function<? super T, ? extends R> mapping) {
118118
Assertions.notNull("v", v);
119119
Assertions.notNull("mapping", mapping);
120120
return is(value -> value.lte(v), mapping);
@@ -124,79 +124,79 @@ public <R extends Expression> BranchesIntermediary<T, R> lte(final T v, final Fu
124124

125125
/**
126126
* A successful check for
127-
* {@linkplain Expression#isBooleanOr(BooleanExpression) being a boolean}
127+
* {@linkplain MqlValue#isBooleanOr(MqlBoolean) being a boolean}
128128
* produces a value specified by the {@code mapping}.
129129
*
130130
* @param mapping the mapping.
131131
* @return the appended sequence of checks.
132132
* @param <R> the type of the produced value.
133133
*/
134-
public <R extends Expression> BranchesIntermediary<T, R> isBoolean(final Function<? super BooleanExpression, ? extends R> mapping) {
134+
public <R extends MqlValue> BranchesIntermediary<T, R> isBoolean(final Function<? super MqlBoolean, ? extends R> mapping) {
135135
Assertions.notNull("mapping", mapping);
136-
return is(v -> mqlEx(v).isBoolean(), v -> mapping.apply((BooleanExpression) v));
136+
return is(v -> mqlEx(v).isBoolean(), v -> mapping.apply((MqlBoolean) v));
137137
}
138138

139139
/**
140140
* A successful check for
141-
* {@linkplain Expression#isNumberOr(NumberExpression) being a number}
141+
* {@linkplain MqlValue#isNumberOr(MqlNumber) being a number}
142142
* produces a value specified by the {@code mapping}.
143143
*
144144
* @mongodb.server.release 4.4
145145
* @param mapping the mapping.
146146
* @return the appended sequence of checks.
147147
* @param <R> the type of the produced value.
148148
*/
149-
public <R extends Expression> BranchesIntermediary<T, R> isNumber(final Function<? super NumberExpression, ? extends R> mapping) {
149+
public <R extends MqlValue> BranchesIntermediary<T, R> isNumber(final Function<? super MqlNumber, ? extends R> mapping) {
150150
Assertions.notNull("mapping", mapping);
151-
return is(v -> mqlEx(v).isNumber(), v -> mapping.apply((NumberExpression) v));
151+
return is(v -> mqlEx(v).isNumber(), v -> mapping.apply((MqlNumber) v));
152152
}
153153

154154
/**
155155
* A successful check for
156-
* {@linkplain Expression#isIntegerOr(IntegerExpression) being an integer}
156+
* {@linkplain MqlValue#isIntegerOr(MqlInteger) being an integer}
157157
* produces a value specified by the {@code mapping}.
158158
*
159159
* @mongodb.server.release 4.4
160160
* @param mapping the mapping.
161161
* @return the appended sequence of checks.
162162
* @param <R> the type of the produced value.
163163
*/
164-
public <R extends Expression> BranchesIntermediary<T, R> isInteger(final Function<? super IntegerExpression, ? extends R> mapping) {
164+
public <R extends MqlValue> BranchesIntermediary<T, R> isInteger(final Function<? super MqlInteger, ? extends R> mapping) {
165165
Assertions.notNull("mapping", mapping);
166-
return is(v -> mqlEx(v).isInteger(), v -> mapping.apply((IntegerExpression) v));
166+
return is(v -> mqlEx(v).isInteger(), v -> mapping.apply((MqlInteger) v));
167167
}
168168

169169
/**
170170
* A successful check for
171-
* {@linkplain Expression#isStringOr(StringExpression) being a string}
171+
* {@linkplain MqlValue#isStringOr(MqlString) being a string}
172172
* produces a value specified by the {@code mapping}.
173173
*
174174
* @param mapping the mapping.
175175
* @return the appended sequence of checks.
176176
* @param <R> the type of the produced value.
177177
*/
178-
public <R extends Expression> BranchesIntermediary<T, R> isString(final Function<? super StringExpression, ? extends R> mapping) {
178+
public <R extends MqlValue> BranchesIntermediary<T, R> isString(final Function<? super MqlString, ? extends R> mapping) {
179179
Assertions.notNull("mapping", mapping);
180-
return is(v -> mqlEx(v).isString(), v -> mapping.apply((StringExpression) v));
180+
return is(v -> mqlEx(v).isString(), v -> mapping.apply((MqlString) v));
181181
}
182182

183183
/**
184184
* A successful check for
185-
* {@linkplain Expression#isDateOr(DateExpression) being a date}
185+
* {@linkplain MqlValue#isDateOr(MqlDate) being a date}
186186
* produces a value specified by the {@code mapping}.
187187
*
188188
* @param mapping the mapping.
189189
* @return the appended sequence of checks.
190190
* @param <R> the type of the produced value.
191191
*/
192-
public <R extends Expression> BranchesIntermediary<T, R> isDate(final Function<? super DateExpression, ? extends R> mapping) {
192+
public <R extends MqlValue> BranchesIntermediary<T, R> isDate(final Function<? super MqlDate, ? extends R> mapping) {
193193
Assertions.notNull("mapping", mapping);
194-
return is(v -> mqlEx(v).isDate(), v -> mapping.apply((DateExpression) v));
194+
return is(v -> mqlEx(v).isDate(), v -> mapping.apply((MqlDate) v));
195195
}
196196

197197
/**
198198
* A successful check for
199-
* {@linkplain Expression#isArrayOr(ArrayExpression) being an array}
199+
* {@linkplain MqlValue#isArrayOr(MqlArray) being an array}
200200
* produces a value specified by the {@code mapping}.
201201
*
202202
* <p>Warning: The type argument of the array is not
@@ -209,32 +209,32 @@ public <R extends Expression> BranchesIntermediary<T, R> isDate(final Function<?
209209
* @param <Q> the type of the array.
210210
*/
211211
@SuppressWarnings("unchecked")
212-
public <R extends Expression, Q extends Expression> BranchesIntermediary<T, R> isArray(final Function<? super ArrayExpression<@MqlUnchecked(TYPE_ARGUMENT) Q>, ? extends R> mapping) {
212+
public <R extends MqlValue, Q extends MqlValue> BranchesIntermediary<T, R> isArray(final Function<? super MqlArray<@MqlUnchecked(TYPE_ARGUMENT) Q>, ? extends R> mapping) {
213213
Assertions.notNull("mapping", mapping);
214-
return is(v -> mqlEx(v).isArray(), v -> mapping.apply((ArrayExpression<Q>) v));
214+
return is(v -> mqlEx(v).isArray(), v -> mapping.apply((MqlArray<Q>) v));
215215
}
216216

217217
/**
218218
* A successful check for
219-
* {@linkplain Expression#isDocumentOr(DocumentExpression) being a document}
219+
* {@linkplain MqlValue#isDocumentOr(MqlDocument) being a document}
220220
* (or document-like value, see
221-
* {@link MapExpression} and {@link EntryExpression})
221+
* {@link MqlMap} and {@link MqlEntry})
222222
* produces a value specified by the {@code mapping}.
223223
*
224224
* @param mapping the mapping.
225225
* @return the appended sequence of checks.
226226
* @param <R> the type of the produced value.
227227
*/
228-
public <R extends Expression> BranchesIntermediary<T, R> isDocument(final Function<? super DocumentExpression, ? extends R> mapping) {
228+
public <R extends MqlValue> BranchesIntermediary<T, R> isDocument(final Function<? super MqlDocument, ? extends R> mapping) {
229229
Assertions.notNull("mapping", mapping);
230-
return is(v -> mqlEx(v).isDocumentOrMap(), v -> mapping.apply((DocumentExpression) v));
230+
return is(v -> mqlEx(v).isDocumentOrMap(), v -> mapping.apply((MqlDocument) v));
231231
}
232232

233233
/**
234234
* A successful check for
235-
* {@linkplain Expression#isMapOr(MapExpression) being a map}
235+
* {@linkplain MqlValue#isMapOr(MqlMap) being a map}
236236
* (or map-like value, see
237-
* {@link DocumentExpression} and {@link EntryExpression})
237+
* {@link MqlDocument} and {@link MqlEntry})
238238
* produces a value specified by the {@code mapping}.
239239
*
240240
* <p>Warning: The type argument of the map is not
@@ -247,21 +247,21 @@ public <R extends Expression> BranchesIntermediary<T, R> isDocument(final Functi
247247
* @param <Q> the type of the array.
248248
*/
249249
@SuppressWarnings("unchecked")
250-
public <R extends Expression, Q extends Expression> BranchesIntermediary<T, R> isMap(final Function<? super MapExpression<@MqlUnchecked(TYPE_ARGUMENT) Q>, ? extends R> mapping) {
250+
public <R extends MqlValue, Q extends MqlValue> BranchesIntermediary<T, R> isMap(final Function<? super MqlMap<@MqlUnchecked(TYPE_ARGUMENT) Q>, ? extends R> mapping) {
251251
Assertions.notNull("mapping", mapping);
252-
return is(v -> mqlEx(v).isDocumentOrMap(), v -> mapping.apply((MapExpression<Q>) v));
252+
return is(v -> mqlEx(v).isDocumentOrMap(), v -> mapping.apply((MqlMap<Q>) v));
253253
}
254254

255255
/**
256256
* A successful check for
257-
* {@linkplain Expressions#ofNull()} being the null value}
257+
* {@linkplain MqlValues#ofNull()} being the null value}
258258
* produces a value specified by the {@code mapping}.
259259
*
260260
* @param mapping the mapping.
261261
* @return the appended sequence of checks.
262262
* @param <R> the type of the produced value.
263263
*/
264-
public <R extends Expression> BranchesIntermediary<T, R> isNull(final Function<? super Expression, ? extends R> mapping) {
264+
public <R extends MqlValue> BranchesIntermediary<T, R> isNull(final Function<? super MqlValue, ? extends R> mapping) {
265265
Assertions.notNull("mapping", mapping);
266266
return is(v -> mqlEx(v).isNull(), v -> mapping.apply(v));
267267
}

0 commit comments

Comments
 (0)