Package org.nuxeo.directory.mongodb
Class MongoDBSerializationHelper
java.lang.Object
org.nuxeo.directory.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 objectstatic 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 mapstatic Object
valueToBson
(Object value) Cast an object according to its instancestatic Object
valueToBson
(Object value, Type type) Cast an object according to its instance ans its type
-
Field Details
-
MONGODB_ID
- See Also:
-
MONGODB_SEQ
- 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
-
valueToBson
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
Create a map from a BSON object- Parameters:
doc
- the BSON object to parse- Returns:
- the new map
-