Browse Source

Introduce MongoConverterConfigurationAdapter#withPropertyValueConversions.

Introduce new builder style method and deprecate exiting setter.

Closes: #4555
Original pull request: #4556
pull/4514/merge
Christoph Strobl 2 years ago committed by Mark Paluch
parent
commit
03f8763623
No known key found for this signature in database
GPG Key ID: 4406B84C1661DCD1
  1. 16
      spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/MongoCustomConversions.java

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

@ -308,8 +308,24 @@ public class MongoCustomConversions extends org.springframework.data.convert.Cus
* @param valueConversions must not be {@literal null}. * @param valueConversions must not be {@literal null}.
* @return this. * @return this.
* @since 3.4 * @since 3.4
* @deprecated since 4.2. Use {@link #withPropertyValueConversions(PropertyValueConversions)} instead.
*/ */
@Deprecated(since = "4.2.0")
public MongoConverterConfigurationAdapter setPropertyValueConversions(PropertyValueConversions valueConversions) { public MongoConverterConfigurationAdapter setPropertyValueConversions(PropertyValueConversions valueConversions) {
return withPropertyValueConversions(valueConversions);
}
/**
* Optionally set the {@link PropertyValueConversions} to be applied during mapping.
* <p>
* Use this method if {@link #configurePropertyConversions(Consumer)} and
* {@link #registerPropertyValueConverterFactory(PropertyValueConverterFactory)} are not sufficient.
*
* @param valueConversions must not be {@literal null}.
* @return this.
* @since 4.2
*/
public MongoConverterConfigurationAdapter withPropertyValueConversions(PropertyValueConversions valueConversions) {
Assert.notNull(valueConversions, "PropertyValueConversions must not be null"); Assert.notNull(valueConversions, "PropertyValueConversions must not be null");
this.propertyValueConversions = valueConversions; this.propertyValueConversions = valueConversions;

Loading…
Cancel
Save