Class ManagedMap<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,V>
java.util.LinkedHashMap<K,V>
org.springframework.beans.factory.support.ManagedMap<K,V>
- Type Parameters:
K
- the key typeV
- the value type
- All Implemented Interfaces:
Serializable
,Cloneable
,Map<K,
,V> BeanMetadataElement
,Mergeable
Tag collection class used to hold managed Map values, which may
include runtime bean references (to be resolved into bean objects).
- Since:
- 27.05.2003
- Author:
- Juergen Hoeller, Rob Harrop
- 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> -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturn the default key type name (class name) to be used for this map.Return the configuration sourceObject
for this metadata element (may benull
).Return the default value type name (class name) to be used for this map.boolean
Is merging enabled for this particular instance?Merge the current value set with that of the supplied object.static <K,
V> ManagedMap<K, V> Return a new instance containing keys and values extracted from the given entries.void
setKeyTypeName
(String keyTypeName) Set the default key type name (class name) to be used for this map.void
setMergeEnabled
(boolean mergeEnabled) Set whether merging should be enabled for this collection, in case of a 'parent' collection value being present.void
Set the configuration sourceObject
for this metadata element.void
setValueTypeName
(String valueTypeName) Set the default value type name (class name) to be used for this map.Methods inherited from class java.util.LinkedHashMap
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, removeEldestEntry, replaceAll, values
Methods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, containsKey, equals, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
-
Constructor Details
-
ManagedMap
public ManagedMap() -
ManagedMap
public ManagedMap(int initialCapacity)
-
-
Method Details
-
ofEntries
@SafeVarargs public static <K,V> ManagedMap<K,V> ofEntries(Map.Entry<? extends K, ? extends V>... entries) Return a new instance containing keys and values extracted from the given entries. The entries themselves are not stored in the map.- Type Parameters:
K
- theMap
's key typeV
- theMap
's value type- Parameters:
entries
-Map.Entry
s containing the keys and values from which the map is populated- Returns:
- a
Map
containing the specified mappings - Since:
- 5.3.16
-
setSource
Set the configuration sourceObject
for this metadata element.The exact type of the object will depend on the configuration mechanism used.
-
getSource
Description copied from interface:BeanMetadataElement
Return the configuration sourceObject
for this metadata element (may benull
).- Specified by:
getSource
in interfaceBeanMetadataElement
-
setKeyTypeName
Set the default key type name (class name) to be used for this map. -
getKeyTypeName
Return the default key type name (class name) to be used for this map. -
setValueTypeName
Set the default value type name (class name) to be used for this map. -
getValueTypeName
Return the default value type name (class name) to be used for this map. -
setMergeEnabled
public void setMergeEnabled(boolean mergeEnabled) Set whether merging should be enabled for this collection, in case of a 'parent' collection value being present. -
isMergeEnabled
public boolean isMergeEnabled()Description copied from interface:Mergeable
Is merging enabled for this particular instance?- Specified by:
isMergeEnabled
in interfaceMergeable
-
merge
Description copied from interface:Mergeable
Merge the current value set with that of the supplied object.The supplied object is considered the parent, and values in the callee's value set must override those of the supplied object.
-