Spring Data Document

org.springframework.data.document.mongodb.convert
Class SimpleMongoConverter

java.lang.Object
  extended by org.springframework.data.document.mongodb.convert.AbstractMongoConverter
      extended by org.springframework.data.document.mongodb.convert.SimpleMongoConverter
All Implemented Interfaces:
InitializingBean, MongoConverter, MongoReader<Object>, MongoWriter<Object>

Deprecated. since Spring 1.0 M3 in favor of MappingMongoConverter The MappingMongoConverter provides all the functionality of the SimpleMongoConverter and will replace it as the default converter used. The SimpleMongoCOnverter will be removed at some point before the GA release.

@Deprecated
public class SimpleMongoConverter
extends AbstractMongoConverter
implements InitializingBean

Basic MongoConverter implementation to convert between domain classes and DBObjects.

Author:
Mark Pollack, Thomas Risberg, Oliver Gierke

Field Summary
 
Fields inherited from class org.springframework.data.document.mongodb.convert.AbstractMongoConverter
conversionService
 
Constructor Summary
SimpleMongoConverter()
          Deprecated. Creates a SimpleMongoConverter.
 
Method Summary
 ObjectId convertObjectId(Object id)
          Deprecated. Returns the ObjectId instance for the given id.
<T> T
convertObjectId(ObjectId id, Class<T> targetType)
          Deprecated. Converts the given ObjectId to the given target type.
protected  Map<String,Object> createMap()
          Deprecated. Create a Map instance.
protected  org.springframework.data.document.mongodb.convert.MongoBeanWrapper createWrapper(Object target, boolean fieldAccess)
          Deprecated. Callback to allow customizing creation of a MongoBeanWrapper.
 List<Class<?>> getGenericParameters(Type genericParameterType)
          Deprecated.  
 org.springframework.data.mapping.model.MappingContext<? extends MongoPersistentEntity<?>,MongoPersistentProperty> getMappingContext()
          Deprecated.  
protected static boolean isSimpleType(Class<?> propertyType)
          Deprecated.  
<S> S
read(Class<S> clazz, DBObject source)
          Deprecated. Ready from the native MongoDB DBObject representation to an instance of the class T.
protected  Map<?,?> readMap(MongoPropertyDescriptors.MongoPropertyDescriptor pd, DBObject dbo, Class<?> targetType)
          Deprecated. Reads every key/value pair from the DBObject into a Map instance.
 void write(Object obj, DBObject dbo)
          Deprecated. Write the given object of type T to the native MongoDB object representation DBObject.
protected  void writeArray(DBObject dbo, String keyToUse, Object[] array)
          Deprecated. Writes the given array to the given DBObject.
protected  void writeMap(DBObject dbo, String mapKey, Map<String,Object> map)
          Deprecated. Writes the given Map to the given DBObject.
 
Methods inherited from class org.springframework.data.document.mongodb.convert.AbstractMongoConverter
afterPropertiesSet, getConversionService, getCustomTarget, maybeConvertArray, maybeConvertList, maybeConvertObject, setCustomConverters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.springframework.beans.factory.InitializingBean
afterPropertiesSet
 

Constructor Detail

SimpleMongoConverter

public SimpleMongoConverter()
Deprecated. 
Creates a SimpleMongoConverter.

Method Detail

getMappingContext

public org.springframework.data.mapping.model.MappingContext<? extends MongoPersistentEntity<?>,MongoPersistentProperty> getMappingContext()
Deprecated. 
Specified by:
getMappingContext in interface MongoConverter

write

public void write(Object obj,
                  DBObject dbo)
Deprecated. 
Description copied from interface: MongoWriter
Write the given object of type T to the native MongoDB object representation DBObject.

Specified by:
write in interface MongoWriter<Object>
Parameters:
obj - The object to convert to a DBObject
dbo - The DBObject to use for writing.

writeMap

protected void writeMap(DBObject dbo,
                        String mapKey,
                        Map<String,Object> map)
Deprecated. 
Writes the given Map to the given DBObject.

Parameters:
dbo -
mapKey -
map -

writeArray

protected void writeArray(DBObject dbo,
                          String keyToUse,
                          Object[] array)
Deprecated. 
Writes the given array to the given DBObject.

Parameters:
dbo -
keyToUse -
array -

read

public <S> S read(Class<S> clazz,
                  DBObject source)
Deprecated. 
Description copied from interface: MongoReader
Ready from the native MongoDB DBObject representation to an instance of the class T. The given type has to be the starting point for marshalling the DBObject into it. So in case there's no real valid data inside DBObject for the given type, just return an empty instance of the given type.

Specified by:
read in interface MongoReader<Object>
Parameters:
clazz - the type of the return value
source - theDBObject
Returns:
the converted object

createMap

protected Map<String,Object> createMap()
Deprecated. 
Create a Map instance. Will return a HashMap by default. Subclasses might want to override this method to use a custom Map implementation.

Returns:

readMap

protected Map<?,?> readMap(MongoPropertyDescriptors.MongoPropertyDescriptor pd,
                           DBObject dbo,
                           Class<?> targetType)
Deprecated. 
Reads every key/value pair from the DBObject into a Map instance.

Parameters:
pd -
dbo -
targetType -
Returns:

isSimpleType

protected static boolean isSimpleType(Class<?> propertyType)
Deprecated. 

createWrapper

protected org.springframework.data.document.mongodb.convert.MongoBeanWrapper createWrapper(Object target,
                                                                                           boolean fieldAccess)
Deprecated. 
Callback to allow customizing creation of a MongoBeanWrapper.

Parameters:
target - the target object to wrap
fieldAccess - whether to use field access or property access
Returns:

getGenericParameters

public List<Class<?>> getGenericParameters(Type genericParameterType)
Deprecated. 

convertObjectId

public <T> T convertObjectId(ObjectId id,
                             Class<T> targetType)
Deprecated. 
Description copied from interface: MongoConverter
Converts the given ObjectId to the given target type.

Specified by:
convertObjectId in interface MongoConverter
Type Parameters:
T - the actual type to create
Parameters:
id - the source ObjectId
targetType - the target type to convert the ObjectId to
Returns:

convertObjectId

public ObjectId convertObjectId(Object id)
Deprecated. 
Description copied from interface: MongoConverter
Returns the ObjectId instance for the given id.

Specified by:
convertObjectId in interface MongoConverter
Returns:

Spring Data Document

Copyright © 2011. All Rights Reserved.