Package com.mongodb

Examples of com.mongodb.DBRefBase


    @Override
    public void setValue(Object value) {
        ObjectId id = null;
        if (value instanceof DBRefBase) {
            DBRefBase ref = (DBRefBase) value;
            setStringFieldValue(Item.namespace, ref.getRef());
            id = (ObjectId) ref.getId();
        } else {
            id = (ObjectId) value;
        }
        setStringFieldValue(Item.string, id.toString());
        setIntFieldValue(Item.time, id._time());
View Full Code Here


        assertEquals(buf.toString(), "{ \"$date\" : \""+format.format(d)+"\"}");
       
        // test  DB_OBJECT implicit in preceding tests
       
        // test  DB_REF_BASE
        DBRefBase dbref = new DBRefBase(null, "test.test", "4d83ab59a39562db9c1ae2af");
        buf = new StringBuilder();
        serializer.serialize(dbref, buf);
        assertEquals(buf.toString(), "{ \"$ref\" : \"test.test\" , \"$id\" : \"4d83ab59a39562db9c1ae2af\"}");
       
        // test  ITERABLE
View Full Code Here

            super(serializer);
        }

        @Override
        public void serialize(Object obj, StringBuilder buf) {
            DBRefBase ref = (DBRefBase) obj;
            BasicDBObject temp = new BasicDBObject();
            temp.put("$ref", ref.getRef());
            temp.put("$id", ref.getId());
            serializer.serialize(temp, buf);
        }
View Full Code Here

TOP

Related Classes of com.mongodb.DBRefBase

Copyright © 2018 www.massapicom. 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.