public class MongoDBSerializationHelper extends Object
Modifier and Type | Field and Description |
---|---|
static String |
MONGODB_ID |
Modifier and Type | Method and Description |
---|---|
static Map<String,Object> |
bsonToFieldMap(org.bson.Document doc)
Create a map from a BSON object
|
protected static Serializable |
bsonToValue(Object value) |
static org.bson.Document |
fieldMapToBson(Map<String,Object> fieldMap)
Create a BSON object from a map
|
static org.bson.Document |
fieldMapToBson(String key,
Object value)
Create a BSON object with a single field from a pair key/value
|
protected static List<Object> |
listToBson(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
|
public static final String MONGODB_ID
public static org.bson.Document fieldMapToBson(String key, Object value)
key
- the key which corresponds to the field id in the objectvalue
- the value which corresponds to the field value in the objectpublic static org.bson.Document fieldMapToBson(Map<String,Object> fieldMap)
fieldMap
- a map of keys/valuespublic static Object valueToBson(Object value)
value
- the object to transformprotected static List<Object> listToBson(List<Object> values)
protected static Object serializableToBson(Object value)
public static Map<String,Object> bsonToFieldMap(org.bson.Document doc)
doc
- the BSON object to parseprotected static Serializable bsonToValue(Object value)
protected static Class<?> scalarToSerializableClass(Class<?> klass)
protected static Serializable scalarToSerializable(Object value)
Copyright © 2018 Nuxeo. All rights reserved.