Ejemplo n.º 1
0
 private static BasicBSONObject canonicalizeBSONObject(final BSONObject from) {
   final BasicBSONObject canonicalized = new BasicBSONObject();
   final TreeSet<String> keysInOrder = new TreeSet<String>(from.keySet());
   for (final String key : keysInOrder) {
     final Object val = from.get(key);
     canonicalized.put(key, canonicalize(val));
   }
   return canonicalized;
 }
Ejemplo n.º 2
0
 public boolean equals(final Object o) {
   if (o == this) {
     return true;
   }
   if (!(o instanceof BSONObject)) {
     return false;
   }
   final BSONObject other = (BSONObject) o;
   return ((HashMap<String, V>) this).keySet().equals(other.keySet())
       && Arrays.equals(
           canonicalizeBSONObject(this).encode(), canonicalizeBSONObject(other).encode());
 }
Ejemplo n.º 3
0
 public void putAll(final BSONObject o) {
   for (final String k : o.keySet()) {
     this.put(k, o.get(k));
   }
 }