@@ -110,7 +110,7 @@ enum ObjectIdToStringConverter implements Converter<ObjectId, String> {
110
110
INSTANCE ;
111
111
112
112
public String convert (ObjectId id ) {
113
- return id == null ? null : id .toString ();
113
+ return id .toString ();
114
114
}
115
115
}
116
116
@@ -136,7 +136,7 @@ enum ObjectIdToBigIntegerConverter implements Converter<ObjectId, BigInteger> {
136
136
INSTANCE ;
137
137
138
138
public BigInteger convert (ObjectId source ) {
139
- return source == null ? null : new BigInteger (source .toString (), 16 );
139
+ return new BigInteger (source .toString (), 16 );
140
140
}
141
141
}
142
142
@@ -149,15 +149,15 @@ enum BigIntegerToObjectIdConverter implements Converter<BigInteger, ObjectId> {
149
149
INSTANCE ;
150
150
151
151
public ObjectId convert (BigInteger source ) {
152
- return source == null ? null : new ObjectId (source .toString (16 ));
152
+ return new ObjectId (source .toString (16 ));
153
153
}
154
154
}
155
155
156
156
enum BigDecimalToStringConverter implements Converter <BigDecimal , String > {
157
157
INSTANCE ;
158
158
159
159
public String convert (BigDecimal source ) {
160
- return source == null ? null : source .toString ();
160
+ return source .toString ();
161
161
}
162
162
}
163
163
@@ -168,7 +168,7 @@ enum BigDecimalToDecimal128Converter implements Converter<BigDecimal, Decimal128
168
168
INSTANCE ;
169
169
170
170
public Decimal128 convert (BigDecimal source ) {
171
- return source == null ? null : new Decimal128 (source );
171
+ return new Decimal128 (source );
172
172
}
173
173
}
174
174
@@ -195,7 +195,7 @@ enum BigIntegerToStringConverter implements Converter<BigInteger, String> {
195
195
INSTANCE ;
196
196
197
197
public String convert (BigInteger source ) {
198
- return source == null ? null : source .toString ();
198
+ return source .toString ();
199
199
}
200
200
}
201
201
@@ -238,11 +238,6 @@ enum DocumentToStringConverter implements Converter<Document, String> {
238
238
239
239
@ Override
240
240
public String convert (Document source ) {
241
-
242
- if (source == null ) {
243
- return null ;
244
- }
245
-
246
241
return source .toJson ();
247
242
}
248
243
}
@@ -258,7 +253,7 @@ enum TermToStringConverter implements Converter<Term, String> {
258
253
259
254
@ Override
260
255
public String convert (Term source ) {
261
- return source == null ? null : source .getFormatted ();
256
+ return source .getFormatted ();
262
257
}
263
258
}
264
259
@@ -273,7 +268,7 @@ enum DocumentToNamedMongoScriptConverter implements Converter<Document, NamedMon
273
268
@ Override
274
269
public NamedMongoScript convert (Document source ) {
275
270
276
- if (source == null ) {
271
+ if (source . isEmpty () ) {
277
272
return null ;
278
273
}
279
274
@@ -295,10 +290,6 @@ enum NamedMongoScriptToDocumentConverter implements Converter<NamedMongoScript,
295
290
@ Override
296
291
public Document convert (NamedMongoScript source ) {
297
292
298
- if (source == null ) {
299
- return new Document ();
300
- }
301
-
302
293
Document document = new Document ();
303
294
304
295
document .put ("_id" , source .getName ());
@@ -325,7 +316,7 @@ enum CurrencyToStringConverter implements Converter<Currency, String> {
325
316
*/
326
317
@ Override
327
318
public String convert (Currency source ) {
328
- return source == null ? null : source .getCurrencyCode ();
319
+ return source .getCurrencyCode ();
329
320
}
330
321
}
331
322
@@ -461,7 +452,7 @@ enum LongToAtomicLongConverter implements Converter<Long, AtomicLong> {
461
452
462
453
@ Override
463
454
public AtomicLong convert (Long source ) {
464
- return source != null ? new AtomicLong (source ) : null ;
455
+ return new AtomicLong (source );
465
456
}
466
457
}
467
458
@@ -477,7 +468,7 @@ enum IntegerToAtomicIntegerConverter implements Converter<Integer, AtomicInteger
477
468
478
469
@ Override
479
470
public AtomicInteger convert (Integer source ) {
480
- return source != null ? new AtomicInteger (source ) : null ;
471
+ return new AtomicInteger (source );
481
472
}
482
473
}
483
474
0 commit comments