|
Spring Data Document | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.data.document.mongodb.convert.SimpleMongoConverter
public class SimpleMongoConverter
Basic MongoConverter implementation to convert between domain classes and DBObjects.
| Constructor Summary | |
|---|---|
SimpleMongoConverter()
Creates a SimpleMongoConverter. |
|
| Method Summary | ||
|---|---|---|
void |
afterPropertiesSet()
|
|
ObjectId |
convertObjectId(Object id)
Returns the ObjectId instance for the given id. |
|
|
convertObjectId(ObjectId id,
Class<T> targetType)
Converts the given ObjectId to the given target type. |
|
protected Map<String,Object> |
createMap()
Create a Map instance. |
|
protected org.springframework.data.document.mongodb.convert.MongoBeanWrapper |
createWrapper(Object target,
boolean fieldAccess)
Callback to allow customizing creation of a MongoBeanWrapper. |
|
List<Class<?>> |
getGenericParameters(Type genericParameterType)
|
|
protected static boolean |
isSimpleType(Class<?> propertyType)
|
|
|
read(Class<S> clazz,
DBObject source)
Ready from the native MongoDB DBObject representation to an instance of the class T. |
|
protected Map<?,?> |
readMap(MongoPropertyDescriptors.MongoPropertyDescriptor pd,
DBObject dbo,
Class<?> targetType)
Reads every key/value pair from the DBObject into a Map instance. |
|
void |
setConverters(Set<?> converters)
Add custom Converter or ConverterFactory instances to be used that will take presidence over
using object traversal to convert and object to/from DBObject |
|
void |
write(Object obj,
DBObject dbo)
Write the given object of type T to the native MongoDB object representation DBObject. |
|
protected void |
writeArray(DBObject dbo,
String keyToUse,
Object[] array)
Writes the given array to the given DBObject. |
|
protected void |
writeMap(DBObject dbo,
String mapKey,
Map<String,Object> map)
Writes the given Map to the given DBObject. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SimpleMongoConverter()
SimpleMongoConverter.
| Method Detail |
|---|
public void setConverters(Set<?> converters)
Converter or ConverterFactory instances to be used that will take presidence over
using object traversal to convert and object to/from DBObject
converters -
public void write(Object obj,
DBObject dbo)
MongoWriter
write in interface MongoWriter<Object>obj - The object to convert to a DBObjectdbo - The DBObject to use for writing.
protected void writeMap(DBObject dbo,
String mapKey,
Map<String,Object> map)
Map to the given DBObject.
dbo - mapKey - map -
protected void writeArray(DBObject dbo,
String keyToUse,
Object[] array)
DBObject.
dbo - keyToUse - array -
public <S> S read(Class<S> clazz,
DBObject source)
MongoReaderDBObject 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.
read in interface MongoReader<Object>clazz - the type of the return valuesource - theDBObject
protected Map<String,Object> createMap()
Map instance. Will return a HashMap by default. Subclasses might want to override this
method to use a custom Map implementation.
protected Map<?,?> readMap(MongoPropertyDescriptors.MongoPropertyDescriptor pd,
DBObject dbo,
Class<?> targetType)
DBObject into a Map instance.
pd - dbo - targetType -
protected static boolean isSimpleType(Class<?> propertyType)
protected org.springframework.data.document.mongodb.convert.MongoBeanWrapper createWrapper(Object target,
boolean fieldAccess)
MongoBeanWrapper.
target - the target object to wrapfieldAccess - whether to use field access or property access
public List<Class<?>> getGenericParameters(Type genericParameterType)
public <T> T convertObjectId(ObjectId id,
Class<T> targetType)
MongoConverterObjectId to the given target type.
convertObjectId in interface MongoConverterT - the actual type to createid - the source ObjectIdtargetType - the target type to convert the ObjectId to
public ObjectId convertObjectId(Object id)
MongoConverterObjectId instance for the given id.
convertObjectId in interface MongoConverterpublic void afterPropertiesSet()
afterPropertiesSet in interface InitializingBean
|
Spring Data Document | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||