Class MongoCustomConversions.MongoConverterConfigurationAdapter
java.lang.Object
org.springframework.data.mongodb.core.convert.MongoCustomConversions.MongoConverterConfigurationAdapter
- Enclosing class:
- MongoCustomConversions
MongoCustomConversions.MongoConverterConfigurationAdapter
encapsulates creation of
CustomConversions.ConverterConfiguration
with MongoDB specifics.- Since:
- 2.3
- Author:
- Christoph Strobl
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionconfigurePropertyConversions
(Consumer<PropertyValueConverterRegistrar<MongoPersistentProperty>> configurationAdapter) Gateway to register property specific converters.Create aMongoCustomConversions.MongoConverterConfigurationAdapter
using the providedconverters
and our own codecs for JSR-310 types.registerConverter
(Converter<?, ?> converter) Add a customConverter
implementation.registerConverterFactory
(ConverterFactory<?, ?> converterFactory) Add a customConverterFactory
implementation.registerConverters
(Collection<?> converters) registerPropertyValueConverterFactory
(PropertyValueConverterFactory converterFactory) Add a custom/defaultPropertyValueConverterFactory
implementation used to servePropertyValueConverter
.setPropertyValueConversions
(PropertyValueConversions valueConversions) Deprecated.since 4.2.Use the native MongoDB Java Drivercodes
forLocalDate
,LocalTime
andLocalDateTime
using aZoneOffset.UTC
.useNativeDriverJavaTimeCodecs
(boolean useNativeDriverJavaTimeCodecs) Set whether to or not to use the native MongoDB Java Drivercodes
forLocalDate
,LocalTime
andLocalDateTime
using aZoneOffset.UTC
.Use SpringDataJsr310 converters
forLocalDate
,LocalTime
andLocalDateTime
using theZoneId.systemDefault()
.withPropertyValueConversions
(PropertyValueConversions valueConversions) Optionally set thePropertyValueConversions
to be applied during mapping.
-
Constructor Details
-
MongoConverterConfigurationAdapter
public MongoConverterConfigurationAdapter()
-
-
Method Details
-
from
Create aMongoCustomConversions.MongoConverterConfigurationAdapter
using the providedconverters
and our own codecs for JSR-310 types.- Parameters:
converters
- must not be null.- Returns:
-
registerConverter
public MongoCustomConversions.MongoConverterConfigurationAdapter registerConverter(Converter<?, ?> converter) Add a customConverter
implementation.- Parameters:
converter
- must not be null.- Returns:
- this.
-
registerConverters
public MongoCustomConversions.MongoConverterConfigurationAdapter registerConverters(Collection<?> converters) - Parameters:
converters
- must not be null nor contain null values.- Returns:
- this.
-
registerConverterFactory
public MongoCustomConversions.MongoConverterConfigurationAdapter registerConverterFactory(ConverterFactory<?, ?> converterFactory) Add a customConverterFactory
implementation.- Parameters:
converterFactory
- must not be null.- Returns:
- this.
-
registerPropertyValueConverterFactory
public MongoCustomConversions.MongoConverterConfigurationAdapter registerPropertyValueConverterFactory(PropertyValueConverterFactory converterFactory) Add a custom/defaultPropertyValueConverterFactory
implementation used to servePropertyValueConverter
.- Parameters:
converterFactory
- must not be null.- Returns:
- this.
- Since:
- 3.4
-
configurePropertyConversions
public MongoCustomConversions.MongoConverterConfigurationAdapter configurePropertyConversions(Consumer<PropertyValueConverterRegistrar<MongoPersistentProperty>> configurationAdapter) Gateway to register property specific converters.- Parameters:
configurationAdapter
- must not be null.- Returns:
- this.
- Since:
- 3.4
-
useNativeDriverJavaTimeCodecs
public MongoCustomConversions.MongoConverterConfigurationAdapter useNativeDriverJavaTimeCodecs(boolean useNativeDriverJavaTimeCodecs) Set whether to or not to use the native MongoDB Java Drivercodes
forLocalDate
,LocalTime
andLocalDateTime
using aZoneOffset.UTC
.- Parameters:
useNativeDriverJavaTimeCodecs
-- Returns:
- this.
-
useNativeDriverJavaTimeCodecs
Use the native MongoDB Java Drivercodes
forLocalDate
,LocalTime
andLocalDateTime
using aZoneOffset.UTC
.- Returns:
- this.
- See Also:
-
useSpringDataJavaTimeCodecs
Use SpringDataJsr310 converters
forLocalDate
,LocalTime
andLocalDateTime
using theZoneId.systemDefault()
.- Returns:
- this.
- See Also:
-
setPropertyValueConversions
@Deprecated(since="4.2.0") public MongoCustomConversions.MongoConverterConfigurationAdapter setPropertyValueConversions(PropertyValueConversions valueConversions) Deprecated.since 4.2. UsewithPropertyValueConversions(PropertyValueConversions)
instead.Optionally set thePropertyValueConversions
to be applied during mapping.Use this method if
configurePropertyConversions(Consumer)
andregisterPropertyValueConverterFactory(PropertyValueConverterFactory)
are not sufficient.- Parameters:
valueConversions
- must not be null.- Returns:
- this.
- Since:
- 3.4
-
withPropertyValueConversions
public MongoCustomConversions.MongoConverterConfigurationAdapter withPropertyValueConversions(PropertyValueConversions valueConversions) Optionally set thePropertyValueConversions
to be applied during mapping.Use this method if
configurePropertyConversions(Consumer)
andregisterPropertyValueConverterFactory(PropertyValueConverterFactory)
are not sufficient.- Parameters:
valueConversions
- must not be null.- Returns:
- this.
- Since:
- 4.2
-