List of usage examples for com.mongodb LazyDBCallback LazyDBCallback
public LazyDBCallback(@Nullable final DBCollection collection)
From source file:org.immutables.mongo.repository.internal.BsonEncoding.java
License:Apache License
public static DBObject unwrapJsonable(String json) { try {/*from w w w .ja va2s .c o m*/ JsonParser parser = JSON_FACTORY.createParser(json); parser.nextToken(); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); BsonGenerator generator = BSON_FACTORY.createGenerator(outputStream); generator.copyCurrentStructure(parser); generator.close(); parser.close(); byte[] data = outputStream.toByteArray(); return (DBObject) new LazyDBCallback(null).createObject(data, 0); } catch (IOException ex) { throw Throwables.propagate(ex); } }