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:
MongoConverter, MongoReader<java.lang.Object>, MongoWriter<java.lang.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

Basic MongoConverter implementation to convert between domain classes and DBObjects.

Author:
Mark Pollack, Thomas Risberg, Oliver Gierke

Field Summary
private static Log LOG
          Deprecated.  
private   mappingContext
          Deprecated.  
private static java.util.List<java.lang.Class<?>> MONGO_TYPES
          Deprecated.  
private static java.util.Set<java.lang.String> SIMPLE_TYPES
          Deprecated.  
 
Fields inherited from class org.springframework.data.document.mongodb.convert.AbstractMongoConverter
conversionService
 
Constructor Summary
SimpleMongoConverter()
          Deprecated. Creates a SimpleMongoConverter.
 
Method Summary
 ObjectId convertObjectId(java.lang.Object id)
          Deprecated. Returns the ObjectId instance for the given id.
<T> T
convertObjectId(ObjectId id, java.lang.Class<T> targetType)
          Deprecated. Converts the given ObjectId to the given target type.
protected  java.util.Map<java.lang.String,java.lang.Object> createMap()
          Deprecated. Create a Map instance.
protected  MongoBeanWrapper createWrapper(java.lang.Object target, boolean fieldAccess)
          Deprecated. Callback to allow customizing creation of a MongoBeanWrapper.
private  java.lang.Class<?> getCustomTargetType(java.lang.Object obj)
          Deprecated. Returns whether the ConversionService has a custom Converter registered that can convert the given object into one of the types supported by MongoDB.
 java.util.List<java.lang.Class<?>> getGenericParameters(java.lang.reflect.Type genericParameterType)
          Deprecated.  
  getMappingContext()
          Deprecated.  
protected static boolean isSimpleType(java.lang.Class<?> propertyType)
          Deprecated.  
<S> S
read(java.lang.Class<S> clazz, DBObject source)
          Deprecated. Ready from the native MongoDB DBObject representation to an instance of the class T.
private  java.util.Collection<java.lang.Object> readCollection(MongoPropertyDescriptors.MongoPropertyDescriptor descriptor, java.util.Collection<?> values)
          Deprecated. Reads the given collection values (that are DBObjects potentially) into a Collection of domain objects.
private  java.lang.Object readCompoundValue(MongoPropertyDescriptors.MongoPropertyDescriptor pd, DBObject dbo)
          Deprecated. Reads a compound value from the given DBObject for the given property.
protected  java.util.Map<?,?> readMap(MongoPropertyDescriptors.MongoPropertyDescriptor pd, DBObject dbo, java.lang.Class<?> targetType)
          Deprecated. Reads every key/value pair from the DBObject into a Map instance.
 void write(java.lang.Object obj, DBObject dbo)
          Deprecated. Write the given object of type T to the native MongoDB object representation DBObject.
protected  void writeArray(DBObject dbo, java.lang.String keyToUse, java.lang.Object[] array)
          Deprecated. Writes the given array to the given DBObject.
private  void writeCompoundValue(DBObject dbo, java.lang.String keyToUse, java.lang.Object value)
          Deprecated. Writes the given CompoundComparator value to the given DBObject.
protected  void writeMap(DBObject dbo, java.lang.String mapKey, java.util.Map<java.lang.String,java.lang.Object> map)
          Deprecated. Writes the given Map to the given DBObject.
private  void writeValue(DBObject dbo, java.lang.String keyToUse, java.lang.Object value)
          Deprecated. Writes the given value 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
 

Field Detail

LOG

private static final Log LOG
Deprecated. 

MONGO_TYPES

private static final java.util.List<java.lang.Class<?>> MONGO_TYPES
Deprecated. 

SIMPLE_TYPES

private static final java.util.Set<java.lang.String> SIMPLE_TYPES
Deprecated. 

mappingContext

private final  mappingContext
Deprecated. 
Constructor Detail

SimpleMongoConverter

public SimpleMongoConverter()
Deprecated. 
Creates a SimpleMongoConverter.

Method Detail

getMappingContext

public  getMappingContext()
Deprecated. 

write

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

Parameters:
obj - The object to convert to a DBObject
dbo - The DBObject to use for writing.

writeValue

private void writeValue(DBObject dbo,
                        java.lang.String keyToUse,
                        java.lang.Object value)
Deprecated. 
Writes the given value to the given DBObject. Will skip null values.

Parameters:
dbo -
keyToUse -
value -

writeCompoundValue

private void writeCompoundValue(DBObject dbo,
                                java.lang.String keyToUse,
                                java.lang.Object value)
Deprecated. 
Writes the given CompoundComparator value to the given DBObject.

Parameters:
dbo -
keyToUse -
value -

getCustomTargetType

private java.lang.Class<?> getCustomTargetType(java.lang.Object obj)
Deprecated. 
Returns whether the ConversionService has a custom Converter registered that can convert the given object into one of the types supported by MongoDB.

Parameters:
obj -
Returns:

writeMap

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

Parameters:
dbo -
mapKey -
map -

writeArray

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

Parameters:
dbo -
keyToUse -
array -

read

public <S> S read(java.lang.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.

Parameters:
clazz - the type of the return value
source - theDBObject
Returns:
the converted object

readCollection

private java.util.Collection<java.lang.Object> readCollection(MongoPropertyDescriptors.MongoPropertyDescriptor descriptor,
                                                              java.util.Collection<?> values)
Deprecated. 
Reads the given collection values (that are DBObjects potentially) into a Collection of domain objects.

Parameters:
descriptor -
values -
Returns:

readCompoundValue

private java.lang.Object readCompoundValue(MongoPropertyDescriptors.MongoPropertyDescriptor pd,
                                           DBObject dbo)
Deprecated. 
Reads a compound value from the given DBObject for the given property.

Parameters:
pd -
dbo -
Returns:

createMap

protected java.util.Map<java.lang.String,java.lang.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 java.util.Map<?,?> readMap(MongoPropertyDescriptors.MongoPropertyDescriptor pd,
                                     DBObject dbo,
                                     java.lang.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(java.lang.Class<?> propertyType)
Deprecated. 

createWrapper

protected MongoBeanWrapper createWrapper(java.lang.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 java.util.List<java.lang.Class<?>> getGenericParameters(java.lang.reflect.Type genericParameterType)
Deprecated. 

convertObjectId

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

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(java.lang.Object id)
Deprecated. 
Description copied from interface: MongoConverter
Returns the ObjectId instance for the given id.

Returns: