org.apache.struts2.dispatcher

## Class ApplicationMap

- java.lang.Object
- - java.util.AbstractMap
  - - org.apache.struts2.dispatcher.ApplicationMap

- All Implemented Interfaces:
    Serializable, Map

      public class ApplicationMap
      extends AbstractMap
      implements Serializable

  A simple implementation of the `Map` interface to handle a collection of attributes and init parameters in a `ServletContext` object. The `entrySet()` method enumerates over all servlet context attributes and init parameters and returns a collection of both. Note, this will occur lazily - only when the entry set is asked for.
  See Also:
    Serialized Form

- - ### Nested Class Summary

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

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

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

      `Map.Entry<K,V>`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ApplicationMap(javax.servlet.ServletContext ctx)` Creates a new map object given the servlet context.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clear()` Removes all entries from the Map and removes all attributes from the servlet context.
    `Set` | `entrySet()` Creates a Set of all servlet context attributes as well as context init parameters.
    `Object` | `get(Object key)` Returns the servlet context attribute or init parameter based on the given key.
    `Object` | `put(Object key, Object value)` Sets a servlet context attribute given a attribute name and value.
    `Object` | `remove(Object key)` Removes the specified servlet context attribute.

    - ### Methods inherited from class java.util.AbstractMap

      `clone, containsKey, containsValue, equals, hashCode, isEmpty, keySet, putAll, size, toString, values`

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

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

- - ### Constructor Detail

    - #### ApplicationMap

          public ApplicationMap(javax.servlet.ServletContext ctx)

      Creates a new map object given the servlet context.
      Parameters:
        `ctx` - the servlet context

  - ### Method Detail

    - #### clear

          public void clear()

      Removes all entries from the Map and removes all attributes from the servlet context.
      Specified by:
        `clear` in interface `Map`
      Overrides:
        `clear` in class `AbstractMap`

    - #### entrySet

          public Set entrySet()

      Creates a Set of all servlet context attributes as well as context init parameters.
      Specified by:
        `entrySet` in interface `Map`
      Specified by:
        `entrySet` in class `AbstractMap`
      Returns:
        a Set of all servlet context attributes as well as context init parameters.

    - #### get

          public Object get(Object key)

      Returns the servlet context attribute or init parameter based on the given key. If the entry is not found, `null` is returned.
      Specified by:
        `get` in interface `Map`
      Overrides:
        `get` in class `AbstractMap`
      Parameters:
        `key` - the entry key.
      Returns:
        the servlet context attribute or init parameter or `null` if the entry is not found.

    - #### put

          public Object put(Object key,
                   Object value)

      Sets a servlet context attribute given a attribute name and value.
      Specified by:
        `put` in interface `Map`
      Overrides:
        `put` in class `AbstractMap`
      Parameters:
        `key` - the name of the attribute.
        `value` - the value to set.
      Returns:
        the attribute that was just set.

    - #### remove

          public Object remove(Object key)

      Removes the specified servlet context attribute.
      Specified by:
        `remove` in interface `Map`
      Overrides:
        `remove` in class `AbstractMap`
      Parameters:
        `key` - the attribute to remove.
      Returns:
        the entry that was just removed.

Copyright © 2000–2019 Apache Software Foundation. All rights reserved.