Class AbstractMongoConverter
java.lang.Object
org.springframework.data.mongodb.core.convert.AbstractMongoConverter
- All Implemented Interfaces:
InitializingBean
,EntityConverter<MongoPersistentEntity<?>,
,MongoPersistentProperty, Object, org.bson.conversions.Bson> EntityReader<Object,
,org.bson.conversions.Bson> EntityWriter<Object,
,org.bson.conversions.Bson> CodecRegistryProvider
,MongoConverter
,MongoWriter<Object>
- Direct Known Subclasses:
MappingMongoConverter
public abstract class AbstractMongoConverter
extends Object
implements MongoConverter, InitializingBean
Base class for
MongoConverter
implementations. Sets up a GenericConversionService
and populates basic
converters. Allows registering CustomConversions
.- Author:
- Jon Brisbin, Oliver Gierke, Mark Paluch, Christoph Strobl
-
Field Summary
Modifier and TypeFieldDescriptionprotected CustomConversions
protected final GenericConversionService
protected EntityInstantiators
-
Constructor Summary
ConstructorDescriptionAbstractMongoConverter
(GenericConversionService conversionService) Creates a newAbstractMongoConverter
using the givenGenericConversionService
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
setCustomConversions
(CustomConversions conversions) Registers the given custom conversions with the converter.void
setInstantiators
(EntityInstantiators instantiators) RegistersEntityInstantiators
to customize entity instantiation.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.data.mongodb.CodecRegistryProvider
getCodecFor, hasCodecFor
Methods inherited from interface org.springframework.data.convert.EntityConverter
getMappingContext
Methods inherited from interface org.springframework.data.convert.EntityReader
read
Methods inherited from interface org.springframework.data.convert.EntityWriter
write
Methods inherited from interface org.springframework.data.mongodb.core.convert.MongoConverter
convertId, getCodecRegistry, getCustomConversions, getProjectionFactory, getTypeMapper, mapValueToTargetType, project
Methods inherited from interface org.springframework.data.mongodb.core.convert.MongoWriter
convertToMongoType, convertToMongoType, convertToMongoType, toDBRef, toDocumentPointer
-
Field Details
-
conversionService
-
conversions
-
instantiators
-
-
Constructor Details
-
AbstractMongoConverter
Creates a newAbstractMongoConverter
using the givenGenericConversionService
.- Parameters:
conversionService
- can be null and defaults toDefaultConversionService
.
-
-
Method Details
-
setCustomConversions
Registers the given custom conversions with the converter.- Parameters:
conversions
- must not be null.
-
setInstantiators
RegistersEntityInstantiators
to customize entity instantiation.- Parameters:
instantiators
- can be null. Uses defaultEntityInstantiators
if so.
-
getConversionService
- Specified by:
getConversionService
in interfaceEntityConverter<MongoPersistentEntity<?>,
MongoPersistentProperty, Object, org.bson.conversions.Bson>
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSet
in interfaceInitializingBean
-