Skip to content

Commit af854ed

Browse files
committed
Remove the type parameter from ClientWriteModel
JAVA-5527
1 parent 48b9614 commit af854ed

File tree

15 files changed

+134
-197
lines changed

15 files changed

+134
-197
lines changed

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

+37-51
Original file line numberDiff line numberDiff line change
@@ -33,27 +33,25 @@
3333
/**
3434
* An individual write operation to be executed as part of a client-level bulk write operation.
3535
*
36-
* @param <T> The document type, for example {@link Document}.
3736
* @since 5.3
3837
*/
39-
// BULK-TODO I don't think T is needed
4038
@Sealed
41-
public interface ClientWriteModel<T> {
39+
public interface ClientWriteModel {
4240
/**
4341
* Creates a model for inserting the {@code document} into the {@code namespace}.
4442
*
4543
* @param namespace The namespace.
4644
* @param document The document.
4745
* @return The requested model.
48-
* @param <T> The document type, for example {@link Document}.
46+
* @param <TDocument> The document type, for example {@link Document}.
4947
* @see Filters
5048
*/
51-
static <T> ClientWriteModel<T> insertOne(
49+
static <TDocument> ClientWriteModel insertOne(
5250
final MongoNamespace namespace,
53-
final T document) {
51+
final TDocument document) {
5452
notNull("namespace", namespace);
5553
notNull("document", document);
56-
return new ClientInsertOneModel<>(namespace, document);
54+
return new ClientInsertOneModel(namespace, document);
5755
}
5856

5957
/**
@@ -65,18 +63,17 @@ static <T> ClientWriteModel<T> insertOne(
6563
* @param filter The filter.
6664
* @param update The update.
6765
* @return The requested model.
68-
* @param <T> The document type, for example {@link Document}.
6966
* @see Filters
7067
* @see Updates
7168
*/
72-
static <T> ClientWriteModel<T> updateOne(
69+
static ClientWriteModel updateOne(
7370
final MongoNamespace namespace,
7471
final Bson filter,
7572
final Bson update) {
7673
notNull("namespace", namespace);
7774
notNull("filter", filter);
7875
notNull("update", update);
79-
return new ClientUpdateOneModel<>(namespace, filter, update, null, null);
76+
return new ClientUpdateOneModel(namespace, filter, update, null, null);
8077
}
8178

8279
/**
@@ -87,11 +84,10 @@ static <T> ClientWriteModel<T> updateOne(
8784
* @param update The update.
8885
* @param options The options.
8986
* @return The requested model.
90-
* @param <T> The document type, for example {@link Document}.
9187
* @see Filters
9288
* @see Updates
9389
*/
94-
static <T> ClientWriteModel<T> updateOne(
90+
static ClientWriteModel updateOne(
9591
final MongoNamespace namespace,
9692
final Bson filter,
9793
final Bson update,
@@ -100,7 +96,7 @@ static <T> ClientWriteModel<T> updateOne(
10096
notNull("filter", filter);
10197
notNull("update", update);
10298
notNull("options", options);
103-
return new ClientUpdateOneModel<>(namespace, filter, update, null, options);
99+
return new ClientUpdateOneModel(namespace, filter, update, null, options);
104100
}
105101

106102
/**
@@ -112,18 +108,17 @@ static <T> ClientWriteModel<T> updateOne(
112108
* @param filter The filter.
113109
* @param updatePipeline The update pipeline.
114110
* @return The requested model.
115-
* @param <T> The document type, for example {@link Document}.
116111
* @see Filters
117112
* @see Updates
118113
*/
119-
static <T> ClientWriteModel<T> updateOne(
114+
static ClientWriteModel updateOne(
120115
final MongoNamespace namespace,
121116
final Bson filter,
122117
final Iterable<? extends Bson> updatePipeline) {
123118
notNull("namespace", namespace);
124119
notNull("filter", filter);
125120
notNull("updatePipeline", updatePipeline);
126-
return new ClientUpdateOneModel<>(namespace, filter, null, updatePipeline, null);
121+
return new ClientUpdateOneModel(namespace, filter, null, updatePipeline, null);
127122
}
128123

129124
/**
@@ -134,11 +129,10 @@ static <T> ClientWriteModel<T> updateOne(
134129
* @param updatePipeline The update pipeline.
135130
* @param options The options.
136131
* @return The requested model.
137-
* @param <T> The document type, for example {@link Document}.
138132
* @see Filters
139133
* @see Updates
140134
*/
141-
static <T> ClientWriteModel<T> updateOne(
135+
static ClientWriteModel updateOne(
142136
final MongoNamespace namespace,
143137
final Bson filter,
144138
final Iterable<? extends Bson> updatePipeline,
@@ -147,7 +141,7 @@ static <T> ClientWriteModel<T> updateOne(
147141
notNull("filter", filter);
148142
notNull("updatePipeline", updatePipeline);
149143
notNull("options", options);
150-
return new ClientUpdateOneModel<>(namespace, filter, null, updatePipeline, options);
144+
return new ClientUpdateOneModel(namespace, filter, null, updatePipeline, options);
151145
}
152146

153147
/**
@@ -159,18 +153,17 @@ static <T> ClientWriteModel<T> updateOne(
159153
* @param filter The filter.
160154
* @param update The update.
161155
* @return The requested model.
162-
* @param <T> The document type, for example {@link Document}.
163156
* @see Filters
164157
* @see Updates
165158
*/
166-
static <T> ClientWriteModel<T> updateMany(
159+
static ClientWriteModel updateMany(
167160
final MongoNamespace namespace,
168161
final Bson filter,
169162
final Bson update) {
170163
notNull("namespace", namespace);
171164
notNull("filter", filter);
172165
notNull("update", update);
173-
return new ClientUpdateManyModel<>(namespace, filter, update, null, null);
166+
return new ClientUpdateManyModel(namespace, filter, update, null, null);
174167
}
175168

176169
/**
@@ -181,11 +174,10 @@ static <T> ClientWriteModel<T> updateMany(
181174
* @param update The update.
182175
* @param options The options.
183176
* @return The requested model.
184-
* @param <T> The document type, for example {@link Document}.
185177
* @see Filters
186178
* @see Updates
187179
*/
188-
static <T> ClientWriteModel<T> updateMany(
180+
static ClientWriteModel updateMany(
189181
final MongoNamespace namespace,
190182
final Bson filter,
191183
final Bson update,
@@ -194,7 +186,7 @@ static <T> ClientWriteModel<T> updateMany(
194186
notNull("filter", filter);
195187
notNull("update", update);
196188
notNull("options", options);
197-
return new ClientUpdateManyModel<>(namespace, filter, update, null, options);
189+
return new ClientUpdateManyModel(namespace, filter, update, null, options);
198190
}
199191

200192
/**
@@ -206,18 +198,17 @@ static <T> ClientWriteModel<T> updateMany(
206198
* @param filter The filter.
207199
* @param updatePipeline The update pipeline.
208200
* @return The requested model.
209-
* @param <T> The document type, for example {@link Document}.
210201
* @see Filters
211202
* @see Updates
212203
*/
213-
static <T> ClientWriteModel<T> updateMany(
204+
static ClientWriteModel updateMany(
214205
final MongoNamespace namespace,
215206
final Bson filter,
216207
final Iterable<? extends Bson> updatePipeline) {
217208
notNull("namespace", namespace);
218209
notNull("filter", filter);
219210
notNull("updatePipeline", updatePipeline);
220-
return new ClientUpdateManyModel<>(namespace, filter, null, updatePipeline, null);
211+
return new ClientUpdateManyModel(namespace, filter, null, updatePipeline, null);
221212
}
222213

223214
/**
@@ -228,11 +219,10 @@ static <T> ClientWriteModel<T> updateMany(
228219
* @param updatePipeline The update pipeline.
229220
* @param options The options.
230221
* @return The requested model.
231-
* @param <T> The document type, for example {@link Document}.
232222
* @see Filters
233223
* @see Updates
234224
*/
235-
static <T> ClientWriteModel<T> updateMany(
225+
static ClientWriteModel updateMany(
236226
final MongoNamespace namespace,
237227
final Bson filter,
238228
final Iterable<? extends Bson> updatePipeline,
@@ -241,7 +231,7 @@ static <T> ClientWriteModel<T> updateMany(
241231
notNull("filter", filter);
242232
notNull("updatePipeline", updatePipeline);
243233
notNull("options", options);
244-
return new ClientUpdateManyModel<>(namespace, filter, null, updatePipeline, options);
234+
return new ClientUpdateManyModel(namespace, filter, null, updatePipeline, options);
245235
}
246236

247237
/**
@@ -253,17 +243,17 @@ static <T> ClientWriteModel<T> updateMany(
253243
* @param filter The filter.
254244
* @param replacement The replacement.
255245
* @return The requested model.
256-
* @param <T> The document type, for example {@link Document}.
246+
* @param <TDocument> The document type, for example {@link Document}.
257247
* @see Filters
258248
*/
259-
static <T> ClientWriteModel<T> replaceOne(
249+
static <TDocument> ClientWriteModel replaceOne(
260250
final MongoNamespace namespace,
261251
final Bson filter,
262-
final T replacement) {
252+
final TDocument replacement) {
263253
notNull("namespace", namespace);
264254
notNull("filter", filter);
265255
notNull("replacement", replacement);
266-
return new ClientReplaceOneModel<>(namespace, filter, replacement, null);
256+
return new ClientReplaceOneModel(namespace, filter, replacement, null);
267257
}
268258

269259
/**
@@ -274,19 +264,19 @@ static <T> ClientWriteModel<T> replaceOne(
274264
* @param replacement The replacement.
275265
* @param options The options.
276266
* @return The requested model.
277-
* @param <T> The document type, for example {@link Document}.
267+
* @param <TDocument> The document type, for example {@link Document}.
278268
* @see Filters
279269
*/
280-
static <T> ClientWriteModel<T> replaceOne(
270+
static <TDocument> ClientWriteModel replaceOne(
281271
final MongoNamespace namespace,
282272
final Bson filter,
283-
final T replacement,
273+
final TDocument replacement,
284274
final ClientReplaceOptions options) {
285275
notNull("namespace", namespace);
286276
notNull("filter", filter);
287277
notNull("replacement", replacement);
288278
notNull("options", options);
289-
return new ClientReplaceOneModel<>(namespace, filter, replacement, options);
279+
return new ClientReplaceOneModel(namespace, filter, replacement, options);
290280
}
291281

292282
/**
@@ -297,15 +287,14 @@ static <T> ClientWriteModel<T> replaceOne(
297287
* @param namespace The namespace.
298288
* @param filter The filter.
299289
* @return The requested model.
300-
* @param <T> The document type, for example {@link Document}.
301290
* @see Filters
302291
*/
303-
static <T> ClientWriteModel<T> deleteOne(
292+
static ClientWriteModel deleteOne(
304293
final MongoNamespace namespace,
305294
final Bson filter) {
306295
notNull("namespace", namespace);
307296
notNull("filter", filter);
308-
return new ClientDeleteOneModel<>(namespace, filter, null);
297+
return new ClientDeleteOneModel(namespace, filter, null);
309298
}
310299

311300
/**
@@ -315,17 +304,16 @@ static <T> ClientWriteModel<T> deleteOne(
315304
* @param filter The filter.
316305
* @param options The options.
317306
* @return The requested model.
318-
* @param <T> The document type, for example {@link Document}.
319307
* @see Filters
320308
*/
321-
static <T> ClientWriteModel<T> deleteOne(
309+
static ClientWriteModel deleteOne(
322310
final MongoNamespace namespace,
323311
final Bson filter,
324312
final ClientDeleteOptions options) {
325313
notNull("namespace", namespace);
326314
notNull("filter", filter);
327315
notNull("options", options);
328-
return new ClientDeleteOneModel<>(namespace, filter, options);
316+
return new ClientDeleteOneModel(namespace, filter, options);
329317
}
330318

331319
/**
@@ -336,15 +324,14 @@ static <T> ClientWriteModel<T> deleteOne(
336324
* @param namespace The namespace.
337325
* @param filter The filter.
338326
* @return The requested model.
339-
* @param <T> The document type, for example {@link Document}.
340327
* @see Filters
341328
*/
342-
static <T> ClientWriteModel<T> deleteMany(
329+
static ClientWriteModel deleteMany(
343330
final MongoNamespace namespace,
344331
final Bson filter) {
345332
notNull("namespace", namespace);
346333
notNull("filter", filter);
347-
return new ClientDeleteManyModel<>(namespace, filter, null);
334+
return new ClientDeleteManyModel(namespace, filter, null);
348335
}
349336

350337
/**
@@ -354,16 +341,15 @@ static <T> ClientWriteModel<T> deleteMany(
354341
* @param filter The filter.
355342
* @param options The options.
356343
* @return The requested model.
357-
* @param <T> The document type, for example {@link Document}.
358344
* @see Filters
359345
*/
360-
static <T> ClientWriteModel<T> deleteMany(
346+
static ClientWriteModel deleteMany(
361347
final MongoNamespace namespace,
362348
final Bson filter,
363349
final ClientDeleteOptions options) {
364350
notNull("namespace", namespace);
365351
notNull("filter", filter);
366352
notNull("options", options);
367-
return new ClientDeleteManyModel<>(namespace, filter, options);
353+
return new ClientDeleteManyModel(namespace, filter, options);
368354
}
369355
}

driver-core/src/main/com/mongodb/internal/client/model/bulk/ClientDeleteManyModel.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
/**
2525
* This class is not part of the public API and may be removed or changed at any time.
2626
*/
27-
public final class ClientDeleteManyModel<T> implements ClientWriteModel<T> {
27+
public final class ClientDeleteManyModel implements ClientWriteModel {
2828
private final MongoNamespace namespace;
2929
private final Bson filter;
3030
private final ConcreteClientDeleteOptions options;

driver-core/src/main/com/mongodb/internal/client/model/bulk/ClientDeleteOneModel.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
/**
2525
* This class is not part of the public API and may be removed or changed at any time.
2626
*/
27-
public final class ClientDeleteOneModel<T> implements ClientWriteModel<T> {
27+
public final class ClientDeleteOneModel implements ClientWriteModel {
2828
private final MongoNamespace namespace;
2929
private final Bson filter;
3030
private final ConcreteClientDeleteOptions options;

driver-core/src/main/com/mongodb/internal/client/model/bulk/ClientInsertOneModel.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121
/**
2222
* This class is not part of the public API and may be removed or changed at any time.
2323
*/
24-
public final class ClientInsertOneModel<T> implements ClientWriteModel<T> {
24+
public final class ClientInsertOneModel implements ClientWriteModel {
2525
private final MongoNamespace namespace;
26-
private final T document;
26+
private final Object document;
2727

2828
public ClientInsertOneModel(
2929
final MongoNamespace namespace,
30-
final T document) {
30+
final Object document) {
3131
this.namespace = namespace;
3232
this.document = document;
3333
}

driver-core/src/main/com/mongodb/internal/client/model/bulk/ClientReplaceOneModel.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@
2424
/**
2525
* This class is not part of the public API and may be removed or changed at any time.
2626
*/
27-
public final class ClientReplaceOneModel<T> implements ClientWriteModel<T> {
27+
public final class ClientReplaceOneModel implements ClientWriteModel {
2828
private final MongoNamespace namespace;
2929
private final Bson filter;
30-
private final T replacement;
30+
private final Object replacement;
3131
private final ConcreteClientReplaceOptions options;
3232

3333
public ClientReplaceOneModel(
3434
final MongoNamespace namespace,
3535
final Bson filter,
36-
final T replacement,
36+
final Object replacement,
3737
@Nullable final ClientReplaceOptions options) {
3838
this.namespace = namespace;
3939
this.filter = filter;

driver-core/src/main/com/mongodb/internal/client/model/bulk/ClientUpdateManyModel.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
/**
2727
* This class is not part of the public API and may be removed or changed at any time.
2828
*/
29-
public final class ClientUpdateManyModel<T> implements ClientWriteModel<T> {
29+
public final class ClientUpdateManyModel implements ClientWriteModel {
3030
private final MongoNamespace namespace;
3131
private final Bson filter;
3232
@Nullable

driver-core/src/main/com/mongodb/internal/client/model/bulk/ClientUpdateOneModel.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
/**
2727
* This class is not part of the public API and may be removed or changed at any time.
2828
*/
29-
public final class ClientUpdateOneModel<T> implements ClientWriteModel<T> {
29+
public final class ClientUpdateOneModel implements ClientWriteModel {
3030
private final MongoNamespace namespace;
3131
private final Bson filter;
3232
@Nullable

0 commit comments

Comments
 (0)