@@ -179,55 +179,62 @@ public static MongoConverterConfigurationAdapter from(List<?> converters) {
179
179
}
180
180
181
181
/**
182
- * Set whether to or not to use the native MongoDB Java Driver {@link org.bson.codecs.Codec codes} for
183
- * {@link org.bson.codecs.jsr310.LocalDateCodec LocalDate}, {@link org.bson.codecs.jsr310.LocalTimeCodec LocalTime}
184
- * and {@link org.bson.codecs.jsr310.LocalDateTimeCodec LocalDateTime} using a {@link ZoneOffset#UTC}.
182
+ * Add a custom {@link Converter} implementation.
185
183
*
186
- * @param useNativeDriverJavaTimeCodecs
184
+ * @param converter must not be {@literal null}.
187
185
* @return this.
188
186
*/
189
- public MongoConverterConfigurationAdapter useNativeDriverJavaTimeCodecs ( boolean useNativeDriverJavaTimeCodecs ) {
187
+ public MongoConverterConfigurationAdapter registerConverter ( Converter <?, ?> converter ) {
190
188
191
- this .useNativeDriverJavaTimeCodecs = useNativeDriverJavaTimeCodecs ;
189
+ Assert .notNull (converter , "Converter must not be null" );
190
+ customConverters .add (converter );
192
191
return this ;
193
192
}
194
193
195
194
/**
196
- * Use the native MongoDB Java Driver {@link org.bson.codecs.Codec codes} for
197
- * {@link org.bson.codecs.jsr310.LocalDateCodec LocalDate}, {@link org.bson.codecs.jsr310.LocalTimeCodec LocalTime}
198
- * and {@link org.bson.codecs.jsr310.LocalDateTimeCodec LocalDateTime} using a {@link ZoneOffset#UTC}.
195
+ * Add {@link Converter converters}, {@link ConverterFactory factories}, {@link ConverterBuilder.ConverterAware
196
+ * converter-aware objects}, and {@link GenericConverter generic converters}.
199
197
*
198
+ * @param converters must not be {@literal null} nor contain {@literal null} values.
200
199
* @return this.
201
- * @see #useNativeDriverJavaTimeCodecs(boolean)
202
200
*/
203
- public MongoConverterConfigurationAdapter useNativeDriverJavaTimeCodecs () {
204
- return useNativeDriverJavaTimeCodecs (true );
201
+ public MongoConverterConfigurationAdapter registerConverters (Collection <?> converters ) {
202
+
203
+ Assert .notNull (converters , "Converters must not be null" );
204
+ Assert .noNullElements (converters , "Converters must not be null nor contain null values" );
205
+
206
+ customConverters .addAll (converters );
207
+ return this ;
205
208
}
206
209
207
210
/**
208
- * Use SpringData {@link Converter Jsr310 converters} for
209
- * {@link org.springframework.data.convert.Jsr310Converters.LocalDateToDateConverter LocalDate},
210
- * {@link org.springframework.data.convert.Jsr310Converters.LocalTimeToDateConverter LocalTime} and
211
- * {@link org.springframework.data.convert.Jsr310Converters.LocalDateTimeToDateConverter LocalDateTime} using the
212
- * {@link ZoneId#systemDefault()}.
211
+ * Add a custom {@link ConverterFactory} implementation.
213
212
*
213
+ * @param converterFactory must not be {@literal null}.
214
214
* @return this.
215
- * @see #useNativeDriverJavaTimeCodecs(boolean)
216
215
*/
217
- public MongoConverterConfigurationAdapter useSpringDataJavaTimeCodecs () {
218
- return useNativeDriverJavaTimeCodecs (false );
216
+ public MongoConverterConfigurationAdapter registerConverterFactory (ConverterFactory <?, ?> converterFactory ) {
217
+
218
+ Assert .notNull (converterFactory , "ConverterFactory must not be null" );
219
+ customConverters .add (converterFactory );
220
+ return this ;
219
221
}
220
222
221
223
/**
222
- * Add a custom {@link Converter} implementation.
224
+ * Add a custom/default {@link PropertyValueConverterFactory} implementation used to serve
225
+ * {@link PropertyValueConverter}.
223
226
*
224
- * @param converter must not be {@literal null}.
227
+ * @param converterFactory must not be {@literal null}.
225
228
* @return this.
229
+ * @since 3.4
226
230
*/
227
- public MongoConverterConfigurationAdapter registerConverter (Converter <?, ?> converter ) {
231
+ public MongoConverterConfigurationAdapter registerPropertyValueConverterFactory (
232
+ PropertyValueConverterFactory converterFactory ) {
228
233
229
- Assert .notNull (converter , "Converter must not be null" );
230
- customConverters .add (converter );
234
+ Assert .state (valueConversions () instanceof SimplePropertyValueConversions ,
235
+ "Configured PropertyValueConversions does not allow setting custom ConverterRegistry" );
236
+
237
+ ((SimplePropertyValueConversions ) valueConversions ()).setConverterFactory (converterFactory );
231
238
return this ;
232
239
}
233
240
@@ -253,50 +260,43 @@ public MongoConverterConfigurationAdapter configurePropertyConversions(
253
260
}
254
261
255
262
/**
256
- * Add a custom {@link ConverterFactory} implementation.
263
+ * Set whether to or not to use the native MongoDB Java Driver {@link org.bson.codecs.Codec codes} for
264
+ * {@link org.bson.codecs.jsr310.LocalDateCodec LocalDate}, {@link org.bson.codecs.jsr310.LocalTimeCodec LocalTime}
265
+ * and {@link org.bson.codecs.jsr310.LocalDateTimeCodec LocalDateTime} using a {@link ZoneOffset#UTC}.
257
266
*
258
- * @param converterFactory must not be {@literal null}.
267
+ * @param useNativeDriverJavaTimeCodecs
259
268
* @return this.
260
269
*/
261
- public MongoConverterConfigurationAdapter registerConverterFactory ( ConverterFactory <?, ?> converterFactory ) {
270
+ public MongoConverterConfigurationAdapter useNativeDriverJavaTimeCodecs ( boolean useNativeDriverJavaTimeCodecs ) {
262
271
263
- Assert .notNull (converterFactory , "ConverterFactory must not be null" );
264
- customConverters .add (converterFactory );
272
+ this .useNativeDriverJavaTimeCodecs = useNativeDriverJavaTimeCodecs ;
265
273
return this ;
266
274
}
267
275
268
276
/**
269
- * Add {@link Converter converters}, {@link ConverterFactory factories}, {@link ConverterBuilder.ConverterAware
270
- * converter-aware objects}, and {@link GenericConverter generic converters}.
277
+ * Use the native MongoDB Java Driver {@link org.bson.codecs.Codec codes} for
278
+ * {@link org.bson.codecs.jsr310.LocalDateCodec LocalDate}, {@link org.bson.codecs.jsr310.LocalTimeCodec LocalTime}
279
+ * and {@link org.bson.codecs.jsr310.LocalDateTimeCodec LocalDateTime} using a {@link ZoneOffset#UTC}.
271
280
*
272
- * @param converters must not be {@literal null} nor contain {@literal null} values.
273
281
* @return this.
282
+ * @see #useNativeDriverJavaTimeCodecs(boolean)
274
283
*/
275
- public MongoConverterConfigurationAdapter registerConverters (Collection <?> converters ) {
276
-
277
- Assert .notNull (converters , "Converters must not be null" );
278
- Assert .noNullElements (converters , "Converters must not be null nor contain null values" );
279
-
280
- customConverters .addAll (converters );
281
- return this ;
284
+ public MongoConverterConfigurationAdapter useNativeDriverJavaTimeCodecs () {
285
+ return useNativeDriverJavaTimeCodecs (true );
282
286
}
283
287
284
288
/**
285
- * Add a custom/default {@link PropertyValueConverterFactory} implementation used to serve
286
- * {@link PropertyValueConverter}.
289
+ * Use SpringData {@link Converter Jsr310 converters} for
290
+ * {@link org.springframework.data.convert.Jsr310Converters.LocalDateToDateConverter LocalDate},
291
+ * {@link org.springframework.data.convert.Jsr310Converters.LocalTimeToDateConverter LocalTime} and
292
+ * {@link org.springframework.data.convert.Jsr310Converters.LocalDateTimeToDateConverter LocalDateTime} using the
293
+ * {@link ZoneId#systemDefault()}.
287
294
*
288
- * @param converterFactory must not be {@literal null}.
289
295
* @return this.
290
- * @since 3.4
296
+ * @see #useNativeDriverJavaTimeCodecs(boolean)
291
297
*/
292
- public MongoConverterConfigurationAdapter registerPropertyValueConverterFactory (
293
- PropertyValueConverterFactory converterFactory ) {
294
-
295
- Assert .state (valueConversions () instanceof SimplePropertyValueConversions ,
296
- "Configured PropertyValueConversions does not allow setting custom ConverterRegistry" );
297
-
298
- ((SimplePropertyValueConversions ) valueConversions ()).setConverterFactory (converterFactory );
299
- return this ;
298
+ public MongoConverterConfigurationAdapter useSpringDataJavaTimeCodecs () {
299
+ return useNativeDriverJavaTimeCodecs (false );
300
300
}
301
301
302
302
/**
0 commit comments