Skip to content

Commit 03f8763

Browse files
christophstroblmp911de
authored andcommitted
Introduce MongoConverterConfigurationAdapter#withPropertyValueConversions.
Introduce new builder style method and deprecate exiting setter. Closes: #4555 Original pull request: #4556
1 parent d94aa12 commit 03f8763

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/MongoCustomConversions.java

+16
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,24 @@ public MongoConverterConfigurationAdapter registerPropertyValueConverterFactory(
308308
* @param valueConversions must not be {@literal null}.
309309
* @return this.
310310
* @since 3.4
311+
* @deprecated since 4.2. Use {@link #withPropertyValueConversions(PropertyValueConversions)} instead.
311312
*/
313+
@Deprecated(since = "4.2.0")
312314
public MongoConverterConfigurationAdapter setPropertyValueConversions(PropertyValueConversions valueConversions) {
315+
return withPropertyValueConversions(valueConversions);
316+
}
317+
318+
/**
319+
* Optionally set the {@link PropertyValueConversions} to be applied during mapping.
320+
* <p>
321+
* Use this method if {@link #configurePropertyConversions(Consumer)} and
322+
* {@link #registerPropertyValueConverterFactory(PropertyValueConverterFactory)} are not sufficient.
323+
*
324+
* @param valueConversions must not be {@literal null}.
325+
* @return this.
326+
* @since 4.2
327+
*/
328+
public MongoConverterConfigurationAdapter withPropertyValueConversions(PropertyValueConversions valueConversions) {
313329

314330
Assert.notNull(valueConversions, "PropertyValueConversions must not be null");
315331
this.propertyValueConversions = valueConversions;

0 commit comments

Comments
 (0)