org.apache.commons.collections.map

## Class AbstractMapDecorator

- java.lang.Object
- - org.apache.commons.collections.map.AbstractMapDecorator

- All Implemented Interfaces:
    Map
  Direct Known Subclasses:
    AbstractBidiMapDecorator, AbstractOrderedMapDecorator, AbstractSortedMapDecorator, DefaultedMap, FixedSizeMap, LazyMap, ListOrderedMap, MultiValueMap, PredicatedMap, TransformedMap, UnmodifiableMap

      public abstract class AbstractMapDecorator
      extends Object
      implements Map

  Provides a base decorator that enables additional functionality to be added to a Map via decoration.

  Methods are forwarded directly to the decorated map.

  This implementation does not perform any special processing with `entrySet()`, `keySet()` or `values()`. Instead it simply returns the set/collection from the wrapped map. This may be undesirable, for example if you are trying to write a validating implementation it would provide a loophole around the validation. But, you might want that loophole, so this class is kept simple.

  Since:
    Commons Collections 3.0
  Version:
    $Revision: 646777 $ $Date: 2008-04-10 14:33:15 +0200 (Thu, 10 Apr 2008) $
  Author:
    Daniel Rall, Stephen Colebourne

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface java.util.Map

      `Map.Entry`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Map` | `map` The map to decorate

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `AbstractMapDecorator()` Constructor only used in deserialization, do not use otherwise.
    `` | `AbstractMapDecorator(Map map)` Constructor that wraps (not copies).

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clear()`
    `boolean` | `containsKey(Object key)`
    `boolean` | `containsValue(Object value)`
    `Set` | `entrySet()`
    `boolean` | `equals(Object object)`
    `Object` | `get(Object key)`
    `protected Map` | `getMap()` Gets the map being decorated.
    `int` | `hashCode()`
    `boolean` | `isEmpty()`
    `Set` | `keySet()`
    `Object` | `put(Object key, Object value)`
    `void` | `putAll(Map mapToCopy)`
    `Object` | `remove(Object key)`
    `int` | `size()`
    `String` | `toString()`
    `Collection` | `values()`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### map

          protected transient Map map

      The map to decorate

  - ### Constructor Detail

    - #### AbstractMapDecorator

          protected AbstractMapDecorator()

      Constructor only used in deserialization, do not use otherwise.
      Since:
        Commons Collections 3.1

    - #### AbstractMapDecorator

          public AbstractMapDecorator(Map map)

      Constructor that wraps (not copies).
      Parameters:
        `map` - the map to decorate, must not be null
      Throws:
        `IllegalArgumentException` - if the collection is null

  - ### Method Detail

    - #### getMap

          protected Map getMap()

      Gets the map being decorated.
      Returns:
        the decorated map

    - #### clear

          public void clear()

      Specified by:
        `clear` in interface `Map`

    - #### containsKey

          public boolean containsKey(Object key)

      Specified by:
        `containsKey` in interface `Map`

    - #### containsValue

          public boolean containsValue(Object value)

      Specified by:
        `containsValue` in interface `Map`

    - #### entrySet

          public Set entrySet()

      Specified by:
        `entrySet` in interface `Map`

    - #### get

          public Object get(Object key)

      Specified by:
        `get` in interface `Map`

    - #### isEmpty

          public boolean isEmpty()

      Specified by:
        `isEmpty` in interface `Map`

    - #### keySet

          public Set keySet()

      Specified by:
        `keySet` in interface `Map`

    - #### put

          public Object put(Object key,
                   Object value)

      Specified by:
        `put` in interface `Map`

    - #### putAll

          public void putAll(Map mapToCopy)

      Specified by:
        `putAll` in interface `Map`

    - #### remove

          public Object remove(Object key)

      Specified by:
        `remove` in interface `Map`

    - #### size

          public int size()

      Specified by:
        `size` in interface `Map`

    - #### values

          public Collection values()

      Specified by:
        `values` in interface `Map`

    - #### equals

          public boolean equals(Object object)

      Specified by:
        `equals` in interface `Map`
      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Specified by:
        `hashCode` in interface `Map`
      Overrides:
        `hashCode` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2001–2015 The Apache Software Foundation. All rights reserved.