public class DBObjectChange
extends java.lang.Object
| Modifier and Type | Field and Description | 
|---|---|
static java.lang.String | 
NAME_PROPERTY
Key for the property map to see if an object's name has been changed. 
 | 
| Modifier | Constructor and Description | 
|---|---|
protected  | 
DBObjectChange(DBObject obj,
              DBObjectProvider pro)  | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
ensureProvider(DBObjectProvider pro)
Ensures the DBObjectProvider that the changed object is from is set on
 this change. 
 | 
static void | 
fireChildrenAdded(DBObject obj,
                 java.util.List added)
Fires a message that children have been added to the given object. 
 | 
static void | 
fireChildrenRemoved(DBObject obj,
                   java.util.List removed)
Fires a message that children have been removed from the given object. 
 | 
static void | 
fireObjectUpdated(DBObject obj)
Fires an empty change message on the given object. 
 | 
static void | 
fireObjectUpdated(DBObject obj,
                 java.util.List<DBObject> added,
                 java.util.List<DBObject> removed,
                 java.util.Map<java.lang.String,java.beans.PropertyChangeEvent> props)
Fires a compound event with added/removed children and changed
 properties. 
 | 
static void | 
firePropertiesChanged(DBObject obj,
                     java.util.Map<java.lang.String,java.beans.PropertyChangeEvent> props)
Fires a message that the given properties have been changed on an
 object. 
 | 
static void | 
firePropertyChanged(DBObject obj,
                   java.beans.PropertyChangeEvent... pces)
Fires a message that the given properties have been changed on an
 object. 
 | 
java.util.Collection<java.lang.String> | 
getAllChangedProperties()
Gets a list of all the properties that have changed in this event. 
 | 
DBObject | 
getDBObject()
Gets the object this change has been on. 
 | 
java.util.List<DBObject> | 
getOwnedObjectsAdded()
Returns any owned objects added to the DBObject as a result of the
 change. 
 | 
java.util.List<DBObject> | 
getOwnedObjectsRemoved()
Returns any owned objects removed from the DBObject as a result
 of the change. 
 | 
java.util.Map<DBObject,DBObjectChange> | 
getOwnedObjectsUpdated()
Returns any changes that have happened to any owned objects. 
 | 
java.util.Collection<DBObjectChange> | 
getOwnedObjectsUpdated(java.lang.String childPropName)
Gets the changes for any owned object updates for the given property
 name. 
 | 
DBObjectChange | 
getOwnedObjectUpdate(DBObject child)
Gets the change for a particular owned DBObject. 
 | 
java.util.Map<java.lang.String,java.beans.PropertyChangeEvent> | 
getPropertiesChanged()
Returns any properties changed on the DBObject as a result of the
 change. 
 | 
java.beans.PropertyChangeEvent | 
getPropertyChange(java.lang.String propertyName)
Gets the PropertyChangeEvent for the given property name. 
 | 
DBObjectProvider | 
getProvider()
Gets the DBObjectProvider that the changed object is from. 
 | 
boolean | 
hasNameChanged()
Convinience method to identify whether the "name" property has been
 changed - looks in the properties changed map for the property as a key. 
 | 
static DBObjectChange | 
merge(DBObjectChange... changes)
Merges two changes into a single change. 
 | 
public static final java.lang.String NAME_PROPERTY
Property.name.hasNameChanged(), 
Property.name, 
Constant Field Valuesprotected DBObjectChange(DBObject obj, DBObjectProvider pro)
public final DBObjectProvider getProvider()
public final void ensureProvider(DBObjectProvider pro)
the - DBObjectProvider containing the changed object.public final DBObject getDBObject()
public java.util.List<DBObject> getOwnedObjectsAdded()
public java.util.List<DBObject> getOwnedObjectsRemoved()
public java.util.Map<java.lang.String,java.beans.PropertyChangeEvent> getPropertiesChanged()
 If you require information about a specific property it is better to
 call getPropertyChange(String) as that won't initialise the
 change events for all properties.
 
 Note: changes to properties on owned objects will not cause a
 PropertyChangeEvent on the parent (because the property value for the
 parent has not changed). Check getOwnedObjectsUpdated() to
 see whether an existing child object's properties have changed.
getPropertyChange(String)public java.beans.PropertyChangeEvent getPropertyChange(java.lang.String propertyName)
 Note: changes to properties on owned objects will not cause a
 PropertyChangeEvent on the parent (because the property value for the
 parent has not changed). Check getOwnedObjectsUpdated() to
 see whether an existing child object's properties have changed.
getPropertiesChanged()public java.util.Map<DBObject,DBObjectChange> getOwnedObjectsUpdated()
 To check for an update to a specific, known, child use
 getOwnedObjectUpdate(DBObject).
 
 It should be safe to call contains/get with a DBObject on the returned
 Map. Implementations should ensure that they use a Map implementation
 that does not do unnecessary comparison (e.g. IdentityHashMap).
public DBObjectChange getOwnedObjectUpdate(DBObject child)
child - the child to get the change forgetOwnedObjectsUpdated(), 
#getOwnedObjectUpdate(String)public java.util.Collection<DBObjectChange> getOwnedObjectsUpdated(java.lang.String childPropName)
childPropName - the name of the child property for owned object
 changes.public java.util.Collection<java.lang.String> getAllChangedProperties()
public boolean hasNameChanged()
NAME_PROPERTYpublic static DBObjectChange merge(DBObjectChange... changes)
changes - the changes to mergejava.lang.IllegalArgumentException - if no changes are provided, or if the
 merged changes are for different objects, or objects from different
 providers.public static void fireObjectUpdated(DBObject obj)
public static void fireChildrenAdded(DBObject obj, java.util.List added)
public static void fireChildrenRemoved(DBObject obj, java.util.List removed)
public static void firePropertyChanged(DBObject obj, java.beans.PropertyChangeEvent... pces)
public static void firePropertiesChanged(DBObject obj, java.util.Map<java.lang.String,java.beans.PropertyChangeEvent> props)