T - The type of the inner elements in case of a collection-based
property.public class ChangedProperty<T extends java.io.Serializable>
extends java.lang.Object
The equality of changed properties only refers to the type (the constant string) of the changed property, the inner elements are ignored. This allows for simple handling in the tracking objects. Changed properties need not and are not valid without the corresponding tracking object.
Tracking of inner elements is kept simple and done via side-effects. That is,
the tracking object may keep a reference to the corresponding map or retrieve
it via getChangedInnerElements(). Make sure to never put
null into the map!
To prevent unwanted behaviour, tracking elements should drop changed
properties as soon as they are provided to the outside world. Usually,
retrieving changed properties also includes resetting them (by creating new
data structures for tracking).
| Constructor and Description |
|---|
ChangedProperty(java.lang.String property)
Creates a new changed property of the designated type without tracking
inner elements.
|
ChangedProperty(java.lang.String property,
java.util.Map<T,ChangeType> changedInnerElements)
Creates a new changed property of the designated type with the designated
map tracking inner elements.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj) |
java.util.Map<T,ChangeType> |
getChangedInnerElements()
Gets the map of all inner elements of the property that have changed, for
instance indexes into a list of values.
|
java.lang.String |
getProperty()
Gets the (type of the) changed property.
|
int |
hashCode() |
java.lang.String |
toString() |
public ChangedProperty(java.lang.String property)
property - The (type of the) changed property.public ChangedProperty(java.lang.String property,
java.util.Map<T,ChangeType> changedInnerElements)
property - The (type of the) changed property.changedInnerElements - The map of all inner elements of the property
that have changed, for instance indexes into a list of values.public java.lang.String getProperty()
public java.util.Map<T,ChangeType> getChangedInnerElements()
null is used for properties that
do not have inner elements or of which inner elements are not tracked.null is used for properties that do not have inner
elements or of which inner elements are not tracked.public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object