Examples of BsonDocument


Examples of org.jongo.bson.BsonDocument

    public void timeDecodeWithBsonJongo(int reps) {

        for (int docIndex = 0; docIndex < reps; docIndex++) {
            DBObject dbo = decode(BsonDBDecoder.FACTORY);
            BsonDocument document = Bson.createDocument(dbo);
            Friend f = engine.unmarshall(document, Friend.class);
        }
    }
View Full Code Here

Examples of org.jongo.bson.BsonDocument

            this.unmarshaller = unmarshaller;
            this.clazz = clazz;
        }

        public T map(DBObject result) {
            BsonDocument bsonDocument = Bson.createDocument(result);
            return unmarshaller.unmarshall(bsonDocument, clazz);
        }
View Full Code Here

Examples of org.jongo.bson.BsonDocument

        }
        return objectIdUpdater.getId(pojo);
    }

    private DBObject convertToDBObject(Object pojo, Object id) {
        BsonDocument document = asBsonDocument(marshaller, pojo);
        return new LazyIdDBObject(document.toByteArray(), marshaller, id);
    }
View Full Code Here

Examples of org.jongo.bson.BsonDocument

    private Object marshallDocument(Object parameter) {

        if (parameter instanceof Enum) {
            return marshallPrimitiveWithWrapper(parameter);
        } else {
            BsonDocument document = marshaller.marshall(parameter);
            DBObject dbo = document.toDBObject();

            if (dbo.keySet().isEmpty()) {
                return marshallPrimitiveWithWrapper(parameter);
            } else {
                return dbo;
View Full Code Here

Examples of org.jongo.bson.BsonDocument

     * custom serializer, so try again after wrapping as an object property.
     * We do this trick only as a fallback since it causes Jackson to consider the parameter
     * as "Object" and thus ignore any annotations that may exist on its actual class.
     */
    private Object marshallPrimitiveWithWrapper(Object parameter) {
        final BsonDocument document;

        Map<String, Object> primitiveWrapper = Collections.singletonMap("wrapped", parameter);
        document = marshaller.marshall(primitiveWrapper);
        return document.toDBObject().get("wrapped");
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.