Package org.nuxeo.directory.mongodb
Class MongoDBSerializationHelper
- java.lang.Object
 - 
- org.nuxeo.directory.mongodb.MongoDBSerializationHelper
 
 
- 
public class MongoDBSerializationHelper extends Object
Helper for serialization/deserialization of BSON objects- Since:
 - 9.1
 
 
- 
- 
Field Summary
Fields Modifier and Type Field Description static StringMONGODB_IDstatic StringMONGODB_SEQ 
- 
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Map<String,Object>bsonToFieldMap(org.bson.Document doc)Create a map from a BSON objectprotected static SerializablebsonToValue(Object value)static org.bson.DocumentfieldMapToBson(String key, Object value)Create a BSON object with a single field from a pair key/valuestatic org.bson.DocumentfieldMapToBson(Map<String,Object> fieldMap)Create a BSON object from a mapprotected static List<Object>listToBson(List<Object> values)protected static SerializablescalarToSerializable(Object value)protected static Class<?>scalarToSerializableClass(Class<?> klass)protected static ObjectserializableToBson(Object value)static ObjectvalueToBson(Object value)Cast an object according to its instancestatic ObjectvalueToBson(Object value, Type type)Cast an object according to its instance ans its type 
 - 
 
- 
- 
Field Detail
- 
MONGODB_ID
public static final String MONGODB_ID
- See Also:
 - Constant Field Values
 
 
- 
MONGODB_SEQ
public static final String MONGODB_SEQ
- See Also:
 - Constant Field Values
 
 
 - 
 
- 
Method Detail
- 
fieldMapToBson
public static org.bson.Document fieldMapToBson(String key, Object value)
Create a BSON object with a single field from a pair key/value- Parameters:
 key- the key which corresponds to the field id in the objectvalue- the value which corresponds to the field value in the object- Returns:
 - the new BSON object
 
 
- 
fieldMapToBson
public static org.bson.Document fieldMapToBson(Map<String,Object> fieldMap)
Create a BSON object from a map- Parameters:
 fieldMap- a map of keys/values- Returns:
 - the new BSON object
 
 
- 
valueToBson
public static Object valueToBson(Object value)
Cast an object according to its instance- Parameters:
 value- the object to transform- Returns:
 - the BSON object
 
 
- 
valueToBson
public static Object valueToBson(Object value, Type type)
Cast an object according to its instance ans its type- Parameters:
 value- the object to transformtype- the object type- Returns:
 - the BSON object
 - Since:
 - 9.2
 
 
- 
bsonToFieldMap
public static Map<String,Object> bsonToFieldMap(org.bson.Document doc)
Create a map from a BSON object- Parameters:
 doc- the BSON object to parse- Returns:
 - the new map
 
 
- 
bsonToValue
protected static Serializable bsonToValue(Object value)
 
- 
scalarToSerializable
protected static Serializable scalarToSerializable(Object value)
 
 - 
 
 -