org.iternine.jeppetto.dao.mongodb.enhance
Class DirtyableDBObjectMap

java.lang.Object
  extended by org.iternine.jeppetto.dao.mongodb.enhance.DirtyableDBObjectMap
All Implemented Interfaces:
com.mongodb.DBObject, Map, org.bson.BSONObject, DirtyableDBObject

public class DirtyableDBObjectMap
extends Object
implements Map, DirtyableDBObject

Despite the lack of explicit generic types, this acts like a Map due to the way MongoDB expects the keys to be expressed. ClassCastExceptions may occur if this is violated.


Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Constructor Summary
DirtyableDBObjectMap()
           
DirtyableDBObjectMap(Map<String,Object> delegate)
           
 
Method Summary
 void clear()
           
 boolean containsField(String field)
           
 boolean containsKey(Object key)
           
 boolean containsKey(String key)
           
 boolean containsValue(Object value)
           
 Set entrySet()
           
 boolean equals(Object o)
           
 Object get(Object key)
           
 Object get(String key)
           
 Object getDelegate()
           
 Iterator<String> getDirtyKeys()
           
 Set getRemovedKeys()
           
 int hashCode()
           
 boolean isDirty()
           
 boolean isEmpty()
           
 boolean isPartialObject()
           
 boolean isPersisted(com.mongodb.DBCollection dbCollection)
           
 Set keySet()
           
 void markAsPartialObject()
           
 void markPersisted(com.mongodb.DBCollection dbCollection)
          Consider the current state of the object to be in sync with the persisted state.
 Object put(Object key, Object value)
           
 Object put(String key, Object value)
           
 void putAll(org.bson.BSONObject bsonObject)
           
 void putAll(Map m)
           
 Object remove(Object key)
           
 Object removeField(String key)
           
 int size()
           
 Map toMap()
           
 Collection values()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DirtyableDBObjectMap

public DirtyableDBObjectMap()

DirtyableDBObjectMap

public DirtyableDBObjectMap(Map<String,Object> delegate)
Method Detail

put

public Object put(Object key,
                  Object value)
Specified by:
put in interface Map

remove

public Object remove(Object key)
Specified by:
remove in interface Map

putAll

public void putAll(Map m)
Specified by:
putAll in interface Map
Specified by:
putAll in interface org.bson.BSONObject

clear

public void clear()
Specified by:
clear in interface Map

size

public int size()
Specified by:
size in interface Map

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Map

containsKey

public boolean containsKey(Object key)
Specified by:
containsKey in interface Map

containsValue

public boolean containsValue(Object value)
Specified by:
containsValue in interface Map

get

public Object get(Object key)
Specified by:
get in interface Map

keySet

public Set keySet()
Specified by:
keySet in interface Map
Specified by:
keySet in interface org.bson.BSONObject

values

public Collection values()
Specified by:
values in interface Map

entrySet

public Set entrySet()
Specified by:
entrySet in interface Map

isDirty

public boolean isDirty()
Specified by:
isDirty in interface DirtyableDBObject
Returns:
true if this object is dirtied from it's persisted state

markPersisted

public void markPersisted(com.mongodb.DBCollection dbCollection)
Description copied from interface: DirtyableDBObject
Consider the current state of the object to be in sync with the persisted state.

Specified by:
markPersisted in interface DirtyableDBObject

isPersisted

public boolean isPersisted(com.mongodb.DBCollection dbCollection)
Specified by:
isPersisted in interface DirtyableDBObject
Returns:
true if this object has a representation in the underlying store.

getDirtyKeys

public Iterator<String> getDirtyKeys()
Specified by:
getDirtyKeys in interface DirtyableDBObject
Returns:
Set of keys corresponding to changed fields in this DBObject

getDelegate

public Object getDelegate()
Specified by:
getDelegate in interface DirtyableDBObject
Returns:
The object this DirtyableDBObject is delegating to, or null if it is managing everything itself

markAsPartialObject

public void markAsPartialObject()
Specified by:
markAsPartialObject in interface com.mongodb.DBObject

isPartialObject

public boolean isPartialObject()
Specified by:
isPartialObject in interface com.mongodb.DBObject

put

public Object put(String key,
                  Object value)
Specified by:
put in interface org.bson.BSONObject

putAll

public void putAll(org.bson.BSONObject bsonObject)
Specified by:
putAll in interface org.bson.BSONObject

get

public Object get(String key)
Specified by:
get in interface org.bson.BSONObject

toMap

public Map toMap()
Specified by:
toMap in interface org.bson.BSONObject

removeField

public Object removeField(String key)
Specified by:
removeField in interface org.bson.BSONObject

containsKey

public boolean containsKey(String key)
Specified by:
containsKey in interface org.bson.BSONObject

containsField

public boolean containsField(String field)
Specified by:
containsField in interface org.bson.BSONObject

getRemovedKeys

public Set getRemovedKeys()

equals

public boolean equals(Object o)
Specified by:
equals in interface Map
Overrides:
equals in class Object

hashCode

public int hashCode()
Specified by:
hashCode in interface Map
Overrides:
hashCode in class Object


Copyright © 2012. All Rights Reserved.