|
Spring Data Graph | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.data.document.mongodb.SimpleMongoConverter
public class SimpleMongoConverter
Basic MongoConverter implementation to convert between domain classes and DBObjects.
| Nested Class Summary | |
|---|---|
static class |
SimpleMongoConverter.BigIntegerToIdConverter
Simple singleton to convert BigIntegers to their ObjectId representation. |
static class |
SimpleMongoConverter.ObjectIdToBigIntegerConverter
Simple singleton to convert ObjectIds to their BigInteger representation. |
static class |
SimpleMongoConverter.ObjectIdToStringConverter
Simple singleton to convert ObjectIds to their String representation. |
static class |
SimpleMongoConverter.StringToObjectIdConverter
Simple singleton to convert Strings to their ObjectId representation. |
| Constructor Summary | |
|---|---|
SimpleMongoConverter()
Creates a SimpleMongoConverter. |
|
SimpleMongoConverter(GenericConversionService conversionService)
Creates a new SimpleMongoConverter for the given ConversionService. |
|
| Method Summary | ||
|---|---|---|
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.MongoBeanWrapper |
createWrapper(Object target,
boolean fieldAccess)
Callback to allow customizing creation of a MongoBeanWrapper. |
|
protected void |
initializeConverters()
Initializes additional converters that handle ObjectId conversion. |
|
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 |
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.
public SimpleMongoConverter(GenericConversionService conversionService)
SimpleMongoConverter for the given ConversionService.
conversionService - | Method Detail |
|---|
protected void initializeConverters()
ObjectId conversion. Will register converters for supported
id types if none are registered for those conversion already. GenericConversionService is configured.
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.MongoBeanWrapper createWrapper(Object target,
boolean fieldAccess)
MongoBeanWrapper.
target - the target object to wrapfieldAccess - whether to use field access or property access
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 MongoConverter
|
Spring Data Graph | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||