Class ChangeTrackingMap<T extends Serializable>
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<T,ChangeType>
de.aristaflow.adept2.model.common.changetracking.ChangeTrackingMap<T>
- Type Parameters:
T- The type of the property values that are changed.
- All Implemented Interfaces:
Serializable,Cloneable,Map<T,ChangeType>
This map extends a normal
HashMap by the means to track and
combine changes for property values. Depending on the type of property value
(and therefore the used ChangeCombiner), several changes of the
same property value are combined to form one change.- Author:
- Ulrich Kreher
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ChangeCombinerThe change combiner used for combining several changes to a property value. -
Constructor Summary
ConstructorsConstructorDescriptionChangeTrackingMap(ChangeCombiner changeCombiner) Creates a newChangeTrackingMapwith the designated change combiner.ChangeTrackingMap(ChangeCombiner changeCombiner, int initialCapacity) Creates a newChangeTrackingMapwith the designated change combiner and the designated initial capacity.ChangeTrackingMap(ChangeCombiner changeCombiner, Map<? extends T, ChangeType> m) Creates a newChangeTrackingMapwith the designated change combiner containing the content of the designated map. -
Method Summary
Modifier and TypeMethodDescriptionchange(T propertyValue, ChangeType changeType) Tracks a change of the designated type for the designated property value and combines the change with an existing one.Methods inherited from class java.util.HashMap
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, valuesMethods inherited from class java.util.AbstractMap
equals, hashCode, toString
-
Field Details
-
changeCombiner
The change combiner used for combining several changes to a property value.
-
-
Constructor Details
-
ChangeTrackingMap
Creates a newChangeTrackingMapwith the designated change combiner.- Parameters:
changeCombiner- The change combiner used for combining several changes to a property value.
-
ChangeTrackingMap
Creates a newChangeTrackingMapwith the designated change combiner and the designated initial capacity.- Parameters:
changeCombiner- The change combiner used for combining several changes to a property value.initialCapacity- The initial capacity for theHashMap.
-
ChangeTrackingMap
Creates a newChangeTrackingMapwith the designated change combiner containing the content of the designated map.- Parameters:
changeCombiner- The change combiner used for combining several changes to a property value.m- The map of which the mappings are to be placed in this map.
-
-
Method Details
-
change
Tracks a change of the designated type for the designated property value and combines the change with an existing one.- Parameters:
propertyValue- The value of the property that has changed.changeType- The type of the change of the property.- Returns:
- The change type as combination of the previous and the current change.
-