@Test public void testToBson() { ObjectConverter<TestClass> c = new ObjectConverter<ObjectConverterTest.TestClass>(); TestClass t = new TestClass(); t.setI(10); t.setS("str"); DBObject bson = c.toBson(t); TestClass t1 = c.fromBson(bson, TestClass.class); Assert.assertEquals(t.getI(), t1.getI()); Assert.assertEquals(t.getS(), t1.getS()); }
public DBObject toBson(T object) { String json = toJson(object); return (DBObject)JSON.parse(json); }
ObjectConverter { public DBObject toBson(T object) { String json = toJson(object); return (DBObject)JSON.parse(json); } }
ObjectConverter { public DBObject toBson(T object) { String json = toJson(object); return (DBObject)JSON.parse(json); }  }
ObjectConverter { public DBObject toBson(T object) { String json = toJson(object); return (DBObject)JSON.parse(json); }  String toJson(T object); JsonNode toJsonNode(T object); T fromJson(String json, Class<T> type); DBObject toBson(T object); T fromBson(DBObject dbObject, Class<T> type); }
ObjectConverter { public DBObject toBson(T object) { String json = toJson(object); return (DBObject)JSON.parse(json); }  String toJson(T object); JsonNode toJsonNode(T object); T fromJson(String json, Class<T> type); DBObject toBson(T object); T fromBson(DBObject dbObject, Class<T> type); static final ObjectMapper mapper; }