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
Constructors -
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
(org.springframework.core.convert.converter.Converter<?, ?> converter) Add a customConverter
implementation.registerConverterFactory
(org.springframework.core.convert.converter.ConverterFactory<?, ?> converterFactory) Add a customConverterFactory
implementation.registerConverters
(Collection<?> converters) registerPropertyValueConverterFactory
(PropertyValueConverterFactory converterFactory) Add a custom/defaultPropertyValueConverterFactory
implementation used to servePropertyValueConverter
.setPropertyValueConversions
(PropertyValueConversions valueConversions) Optionally set thePropertyValueConversions
to be applied during mapping.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()
.
-
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:
-
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:
-
registerConverter
public MongoCustomConversions.MongoConverterConfigurationAdapter registerConverter(org.springframework.core.convert.converter.Converter<?, ?> converter) Add a customConverter
implementation.- Parameters:
converter
- must not be null.- Returns:
- this.
-
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
-
registerConverterFactory
public MongoCustomConversions.MongoConverterConfigurationAdapter registerConverterFactory(org.springframework.core.convert.converter.ConverterFactory<?, ?> converterFactory) Add a customConverterFactory
implementation.- Parameters:
converterFactory
- 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.
-
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
-
setPropertyValueConversions
public MongoCustomConversions.MongoConverterConfigurationAdapter setPropertyValueConversions(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:
- 3.4
-