Package org.alfresco.util
Class PropertyMap
- All Implemented Interfaces:
Serializable,Cloneable,Map<QName,Serializable>
Property map helper class.
This class can be used as a short hand when a class of type Map<QName, Serializable> is required.
- Author:
- Roy Wetherall
- 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 TypeFieldDescriptionstatic final Map<QName,Serializable> A static empty map to us when having to deal with nulls -
Constructor Summary
ConstructorsConstructorDescriptionPropertyMap(int initialCapacity) PropertyMap(int initialCapacity, float loadFactor) -
Method Summary
Modifier and TypeMethodDescriptionstatic Map<QName,Serializable> getAddedProperties(Map<QName, Serializable> before, Map<QName, Serializable> after) Utility method to get properties which were added as part of a change.static Pair<Map<QName,Serializable>, Map<QName, Serializable>> getBeforeAndAfterMapsForChanges(Map<QName, Serializable> before, Map<QName, Serializable> after) Utility method to remove unchanged entries from each map.static Map<QName,Serializable> getChangedProperties(Map<QName, Serializable> before, Map<QName, Serializable> after) Utility method to get properties which were changed (but not added or removed) as part of a change.static Map<QName,Serializable> getRemovedProperties(Map<QName, Serializable> before, Map<QName, Serializable> after) Utility method to get properties which were removed as part of a change.static Map<QName,Serializable> getUnchangedProperties(Map<QName, Serializable> before, Map<QName, Serializable> after) Utility method to get properties which were unchanged as part of a change.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
-
EMPTY_MAP
A static empty map to us when having to deal with nulls
-
-
Constructor Details
-
PropertyMap
public PropertyMap(int initialCapacity, float loadFactor) - See Also:
-
PropertyMap
public PropertyMap(int initialCapacity) - See Also:
-
PropertyMap
public PropertyMap()- See Also:
-
-
Method Details
-
getBeforeAndAfterMapsForChanges
public static Pair<Map<QName,Serializable>, getBeforeAndAfterMapsForChangesMap<QName, Serializable>> (Map<QName, Serializable> before, Map<QName, Serializable> after) Utility method to remove unchanged entries from each map.- Parameters:
before- the properties before (may be null)after- the properties after (may be null)- Returns:
- Return a map of values that changed from before to after. The before value is first and the after value is second.
- Since:
- 3.2
-
getAddedProperties
public static Map<QName,Serializable> getAddedProperties(Map<QName, Serializable> before, Map<QName, Serializable> after) Utility method to get properties which were added as part of a change.- Parameters:
before- the properties before (may benull).after- the properties after (may benull).- Returns:
- a map of values that were added along with their new values.
- Since:
- Odin
-
getRemovedProperties
public static Map<QName,Serializable> getRemovedProperties(Map<QName, Serializable> before, Map<QName, Serializable> after) Utility method to get properties which were removed as part of a change.- Parameters:
before- the properties before (may benull).after- the properties after (may benull).- Returns:
- a map of values that were removed along with their old values.
- Since:
- Odin
-
getChangedProperties
public static Map<QName,Serializable> getChangedProperties(Map<QName, Serializable> before, Map<QName, Serializable> after) Utility method to get properties which were changed (but not added or removed) as part of a change.- Parameters:
before- the properties before (may benull).after- the properties after (may benull).- Returns:
- a map of values that were changed along with their new values.
- Since:
- Odin
-
getUnchangedProperties
public static Map<QName,Serializable> getUnchangedProperties(Map<QName, Serializable> before, Map<QName, Serializable> after) Utility method to get properties which were unchanged as part of a change.- Parameters:
before- the properties before (may benull).after- the properties after (may benull).- Returns:
- a map of values that were unchanged along with their values.
- Since:
- Odin
-