org.springframework.data.mongodb.core.convert
Class AbstractMongoConverter
java.lang.Object
org.springframework.data.mongodb.core.convert.AbstractMongoConverter
- All Implemented Interfaces:
- InitializingBean, EntityConverter<MongoPersistentEntity<?>,MongoPersistentProperty,Object,com.mongodb.DBObject>, EntityReader<Object,com.mongodb.DBObject>, EntityWriter<Object,com.mongodb.DBObject>, 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
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.convert.EntityReader |
read |
conversionService
protected final GenericConversionService conversionService
conversions
protected CustomConversions conversions
instantiators
protected EntityInstantiators instantiators
AbstractMongoConverter
public AbstractMongoConverter(GenericConversionService conversionService)
- Creates a new
AbstractMongoConverter
using the given GenericConversionService
.
- Parameters:
conversionService
-
setCustomConversions
public void setCustomConversions(CustomConversions conversions)
- Registers the given custom conversions with the converter.
- Parameters:
conversions
-
setInstantiators
public void setInstantiators(EntityInstantiators instantiators)
- Registers
EntityInstantiators
to customize entity instantiation.
- Parameters:
instantiators
-
convertToMongoType
public Object convertToMongoType(Object obj)
- Description copied from interface:
MongoWriter
- Converts the given object into one Mongo will be able to store natively. If the given object can already be stored
as is, no conversion will happen.
- Specified by:
convertToMongoType
in interface MongoWriter<Object>
- Parameters:
obj
- can be null.
- Returns:
getConversionService
public ConversionService getConversionService()
- Specified by:
getConversionService
in interface EntityConverter<MongoPersistentEntity<?>,MongoPersistentProperty,Object,com.mongodb.DBObject>
afterPropertiesSet
public void afterPropertiesSet()
- Specified by:
afterPropertiesSet
in interface InitializingBean
Copyright © 2011-2013-2013 SpringSource. All Rights Reserved.