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
Fields -
Method Summary
Modifier and TypeMethodDescriptionbsonToFieldMap(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 maplistToBson(List<?> 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 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
-