Class ChangedProperty<T extends Serializable>
- Type Parameters:
T- The type of the inner elements in case of a collection-based property.
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).
- Author:
- Ulrich Kreher
-
Constructor Summary
ConstructorsConstructorDescriptionChangedProperty(String property) Creates a new changed property of the designated type without tracking inner elements.ChangedProperty(String property, Map<T, ChangeType> changedInnerElements) Creates a new changed property of the designated type with the designated map tracking inner elements. -
Method Summary
-
Constructor Details
-
ChangedProperty
Creates a new changed property of the designated type without tracking inner elements.- Parameters:
property- The (type of the) changed property.
-
ChangedProperty
Creates a new changed property of the designated type with the designated map tracking inner elements. Note that the map may be changed by side-effects from outside this class.- Parameters:
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.
-
-
Method Details
-
getProperty
Gets the (type of the) changed property.- Returns:
- The (type of the) changed property.
-
getChangedInnerElements
Gets the map of all inner elements of the property that have changed, for instance indexes into a list of values. An empty map indicates that no inner elements have changed,nullis used for properties that do not have inner elements or of which inner elements are not tracked.- Returns:
- The map of all inner elements of the property that have changed. An
empty map indicates that no inner elements have changed,
nullis used for properties that do not have inner elements or of which inner elements are not tracked.
-
hashCode
public int hashCode() -
equals
-
toString
-