|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.data.document.mongodb.convert.AbstractMongoConverter org.springframework.data.document.mongodb.convert.SimpleMongoConverter
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
Basic MongoConverter
implementation to convert between domain classes and DBObject
s.
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. |
|
|
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. |
|
|
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 DBObject s 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 |
---|
private static final Log LOG
private static final java.util.List<java.lang.Class<?>> MONGO_TYPES
private static final java.util.Set<java.lang.String> SIMPLE_TYPES
private finalmappingContext
Constructor Detail |
---|
public SimpleMongoConverter()
SimpleMongoConverter
.
Method Detail |
---|
publicgetMappingContext()
public void write(java.lang.Object obj, DBObject dbo)
MongoWriter
obj
- The object to convert to a DBObjectdbo
- The DBObject to use for writing.private void writeValue(DBObject dbo, java.lang.String keyToUse, java.lang.Object value)
DBObject
. Will skip null values.
dbo
- keyToUse
- value
- private void writeCompoundValue(DBObject dbo, java.lang.String keyToUse, java.lang.Object value)
CompoundComparator
value to the given DBObject
.
dbo
- keyToUse
- value
- private java.lang.Class<?> getCustomTargetType(java.lang.Object obj)
ConversionService
has a custom Converter
registered that can convert the given
object into one of the types supported by MongoDB.
obj
-
protected void writeMap(DBObject dbo, java.lang.String mapKey, java.util.Map<java.lang.String,java.lang.Object> map)
Map
to the given DBObject
.
dbo
- mapKey
- map
- protected void writeArray(DBObject dbo, java.lang.String keyToUse, java.lang.Object[] array)
DBObject
.
dbo
- keyToUse
- array
- public <S> S read(java.lang.Class<S> clazz, DBObject source)
MongoReader
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.
clazz
- the type of the return valuesource
- theDBObject
private java.util.Collection<java.lang.Object> readCollection(MongoPropertyDescriptors.MongoPropertyDescriptor descriptor, java.util.Collection<?> values)
DBObject
s potentially) into a Collection
of domain
objects.
descriptor
- values
-
private java.lang.Object readCompoundValue(MongoPropertyDescriptors.MongoPropertyDescriptor pd, DBObject dbo)
DBObject
for the given property.
pd
- dbo
-
protected java.util.Map<java.lang.String,java.lang.Object> createMap()
Map
instance. Will return a HashMap
by default. Subclasses might want to override this
method to use a custom Map
implementation.
protected java.util.Map<?,?> readMap(MongoPropertyDescriptors.MongoPropertyDescriptor pd, DBObject dbo, java.lang.Class<?> targetType)
DBObject
into a Map
instance.
pd
- dbo
- targetType
-
protected static boolean isSimpleType(java.lang.Class<?> propertyType)
protected MongoBeanWrapper createWrapper(java.lang.Object target, boolean fieldAccess)
MongoBeanWrapper
.
target
- the target object to wrapfieldAccess
- whether to use field access or property access
public java.util.List<java.lang.Class<?>> getGenericParameters(java.lang.reflect.Type genericParameterType)
public <T> T convertObjectId(ObjectId id, java.lang.Class<T> targetType)
MongoConverter
ObjectId
to the given target type.
T
- the actual type to createid
- the source ObjectId
targetType
- the target type to convert the ObjectId
to
public ObjectId convertObjectId(java.lang.Object id)
MongoConverter
ObjectId
instance for the given id.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |