Code example for Pattern

Methods: flags, pattern

0
                new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
        format.setCalendar(new GregorianCalendar(new SimpleTimeZone(0, "GMT")));
        assert (a.get("date").equals(format.parse("2011-05-18T18:56:00Z")));
        Pattern pat = (Pattern) a.get("pat");
        Pattern pat2 = Pattern.compile(".*", BSON.regexFlags(""));
        assert (pat.pattern().equals(pat2.pattern()));
        assert (pat.flags() == (pat2.flags()));
        ObjectId oid = (ObjectId) a.get("oid");
        assert (oid.equals(new ObjectId("4d83ab3ea39562db9c1ae2ae")));
        DBRef ref = (DBRef) a.get("ref");
        assert (ref.equals(new DBRef(null, "test.test", new ObjectId("4d83ab59a39562db9c1ae2af"))));
        assert (a.get("code").equals(new Code("asdfdsa")));
        assert (a.get("codews").equals(new CodeWScope("ggggg", new BasicBSONObject())));
        assert (a.get("ts").equals(new BSONTimestamp(1300474885, 10)));
        assert (a.get("uuid").equals(UUID.fromString("60f65152-6d4a-4f11-9c9b-590b575da7b5")));
        String json2 = JSON.serialize(a);
        BasicDBObject b = (BasicDBObject) JSON.parse(json2);
        a.equals(b);
        assert (a.equals(b));
    } 
}