org.springframework.data.document.mongodb.convert
Class AbstractMongoConverter
java.lang.Object
org.springframework.data.document.mongodb.convert.AbstractMongoConverter
- All Implemented Interfaces:
- MongoConverter, MongoReader<java.lang.Object>, MongoWriter<java.lang.Object>
- Direct Known Subclasses:
- MappingMongoConverter, SimpleMongoConverter
public abstract class AbstractMongoConverter
- extends java.lang.Object
- implements MongoConverter
- Author:
- Jon Brisbin
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.document.mongodb.MongoWriter |
write |
Methods inherited from interface org.springframework.data.document.mongodb.MongoReader |
read |
MONGO_TYPES
private static final java.util.List<java.lang.Class<?>> MONGO_TYPES
conversionService
protected final GenericConversionService conversionService
customTypeMapping
private final java.util.Set<ConvertiblePair> customTypeMapping
AbstractMongoConverter
public AbstractMongoConverter(GenericConversionService conversionService)
setCustomConverters
public void setCustomConverters(java.util.Set<?> converters)
- Add custom
AbstractMongoConverter.CustomToStringConverter
or ConverterFactory
instances to be used that will take presidence over
metadata driven conversion between of objects to/from DBObject
- Parameters:
converters
-
initializeConverters
private void initializeConverters()
- Registers converters for
ObjectId
handling, removes plain Object.toString()
converter and promotes the
configured ConversionService
to MappingBeanHelper
.
registerConverter
private void registerConverter(java.lang.Object converter)
- Inspects the given
AbstractMongoConverter.CustomToStringConverter
for the types it can convert and registers the pair for custom type conversion
in case the target type is a Mongo basic type.
- Parameters:
converter
-
getCustomTarget
protected java.lang.Class<?> getCustomTarget(java.lang.Class<?> source,
java.lang.Class<?> expectedTargetType)
getConversionService
public ConversionService getConversionService()
- Specified by:
getConversionService
in interface MongoConverter
afterPropertiesSet
public void afterPropertiesSet()
maybeConvertObject
public java.lang.Object maybeConvertObject(java.lang.Object obj)
- Specified by:
maybeConvertObject
in interface MongoConverter
maybeConvertArray
public java.lang.Object[] maybeConvertArray(java.lang.Object[] src)
- Specified by:
maybeConvertArray
in interface MongoConverter
maybeConvertList
public BasicDBList maybeConvertList(BasicDBList dbl)
- Specified by:
maybeConvertList
in interface MongoConverter