@@ -179,55 +179,62 @@ public static MongoConverterConfigurationAdapter from(List<?> converters) {
179179 }
180180
181181 /**
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.
185183 *
186- * @param useNativeDriverJavaTimeCodecs
184+ * @param converter must not be {@literal null}.
187185 * @return this.
188186 */
189- public MongoConverterConfigurationAdapter useNativeDriverJavaTimeCodecs ( boolean useNativeDriverJavaTimeCodecs ) {
187+ public MongoConverterConfigurationAdapter registerConverter ( Converter <?, ?> converter ) {
190188
191- this .useNativeDriverJavaTimeCodecs = useNativeDriverJavaTimeCodecs ;
189+ Assert .notNull (converter , "Converter must not be null" );
190+ customConverters .add (converter );
192191 return this ;
193192 }
194193
195194 /**
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}.
199197 *
198+ * @param converters must not be {@literal null} nor contain {@literal null} values.
200199 * @return this.
201- * @see #useNativeDriverJavaTimeCodecs(boolean)
202200 */
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 ;
205208 }
206209
207210 /**
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.
213212 *
213+ * @param converterFactory must not be {@literal null}.
214214 * @return this.
215- * @see #useNativeDriverJavaTimeCodecs(boolean)
216215 */
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 ;
219221 }
220222
221223 /**
222- * Add a custom {@link Converter} implementation.
224+ * Add a custom/default {@link PropertyValueConverterFactory} implementation used to serve
225+ * {@link PropertyValueConverter}.
223226 *
224- * @param converter must not be {@literal null}.
227+ * @param converterFactory must not be {@literal null}.
225228 * @return this.
229+ * @since 3.4
226230 */
227- public MongoConverterConfigurationAdapter registerConverter (Converter <?, ?> converter ) {
231+ public MongoConverterConfigurationAdapter registerPropertyValueConverterFactory (
232+ PropertyValueConverterFactory converterFactory ) {
228233
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 );
231238 return this ;
232239 }
233240
@@ -253,50 +260,43 @@ public MongoConverterConfigurationAdapter configurePropertyConversions(
253260 }
254261
255262 /**
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}.
257266 *
258- * @param converterFactory must not be {@literal null}.
267+ * @param useNativeDriverJavaTimeCodecs
259268 * @return this.
260269 */
261- public MongoConverterConfigurationAdapter registerConverterFactory ( ConverterFactory <?, ?> converterFactory ) {
270+ public MongoConverterConfigurationAdapter useNativeDriverJavaTimeCodecs ( boolean useNativeDriverJavaTimeCodecs ) {
262271
263- Assert .notNull (converterFactory , "ConverterFactory must not be null" );
264- customConverters .add (converterFactory );
272+ this .useNativeDriverJavaTimeCodecs = useNativeDriverJavaTimeCodecs ;
265273 return this ;
266274 }
267275
268276 /**
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}.
271280 *
272- * @param converters must not be {@literal null} nor contain {@literal null} values.
273281 * @return this.
282+ * @see #useNativeDriverJavaTimeCodecs(boolean)
274283 */
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 );
282286 }
283287
284288 /**
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()}.
287294 *
288- * @param converterFactory must not be {@literal null}.
289295 * @return this.
290- * @since 3.4
296+ * @see #useNativeDriverJavaTimeCodecs(boolean)
291297 */
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 );
300300 }
301301
302302 /**
0 commit comments