org.springframework.beans.factory.support

## 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 type
    `V` - the value type
  All Implemented Interfaces:
    Serializable, Cloneable, Map<K,V>, BeanMetadataElement, Mergeable

      public class ManagedMap<K,V>
      extends LinkedHashMap<K,V>
      implements Mergeable, BeanMetadataElement

  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:
    Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class java.util.AbstractMap

      `AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ManagedMap()`
    `ManagedMap(int initialCapacity)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getKeyTypeName()` Return the default key type name (class name) to be used for this map.
    `Object` | `getSource()` Return the configuration source `Object` for this metadata element (may be `null`).
    `String` | `getValueTypeName()` Return the default value type name (class name) to be used for this map.
    `boolean` | `isMergeEnabled()` Is merging enabled for this particular instance?
    `Object` | `merge(Object parent)` Merge the current value set with that of the supplied object.
    `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.
    `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` | `setSource(Object source)` Set the configuration source `Object` 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 Detail

    - #### ManagedMap

          public ManagedMap()

    - #### ManagedMap

          public ManagedMap(int initialCapacity)

  - ### Method Detail

    - #### 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` - the `Map`'s key type
        `V` - the `Map`'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

          public void setSource(@Nullable
                                Object source)

      Set the configuration source `Object` for this metadata element.

      The exact type of the object will depend on the configuration mechanism used.

    - #### getSource

          @Nullable
          public Object getSource()

      Description copied from interface: `BeanMetadataElement`
      Return the configuration source `Object` for this metadata element (may be `null`).
      Specified by:
        `getSource` in interface `BeanMetadataElement`

    - #### setKeyTypeName

          public void setKeyTypeName(@Nullable
                                     String keyTypeName)

      Set the default key type name (class name) to be used for this map.

    - #### getKeyTypeName

          @Nullable
          public String getKeyTypeName()

      Return the default key type name (class name) to be used for this map.

    - #### setValueTypeName

          public void setValueTypeName(@Nullable
                                       String valueTypeName)

      Set the default value type name (class name) to be used for this map.

    - #### getValueTypeName

          @Nullable
          public String 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 interface `Mergeable`

    - #### merge

          public Object merge(@Nullable
                              Object parent)

      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.

      Specified by:
        `merge` in interface `Mergeable`
      Parameters:
        `parent` - the object to merge with
      Returns:
        the result of the merge operation