Package org.nuxeo.runtime.mongodb
Class MongoDBSerializationHelper
java.lang.Object
org.nuxeo.runtime.mongodb.MongoDBSerializationHelper
Helper for serialization/deserialization of BSON objects
- Since:
- 9.1
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionbsonToFieldMap
(org.bson.Document doc) Create a map from a BSON objectprotected static Serializable
bsonToValue
(Object value) static org.bson.Document
fieldMapToBson
(String key, Object value) Create a BSON object with a single field from a pair key/valuestatic org.bson.Document
fieldMapToBson
(Map<String, Object> fieldMap) Create a BSON object from a maplistToBson
(List<Object> values) protected static Serializable
scalarToSerializable
(Object value) protected static Class<?>
scalarToSerializableClass
(Class<?> klass) protected static Object
serializableToBson
(Object value) static Object
valueToBson
(Object value) Cast an object according to its instance
-
Field Details
-
MONGODB_ID
- See Also:
-
-
Method Details
-
fieldMapToBson
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
Create a BSON object from a map- Parameters:
fieldMap
- a map of keys/values- Returns:
- the new BSON object
-
valueToBson
Cast an object according to its instance- Parameters:
value
- the object to transform- Returns:
- the BSON object
-
listToBson
-
serializableToBson
-
bsonToFieldMap
Create a map from a BSON object- Parameters:
doc
- the BSON object to parse- Returns:
- the new map
-
bsonToValue
-
scalarToSerializableClass
-
scalarToSerializable
-