Class MapProxy<D,R>

java.lang.Object
eu.bandm.tools.umod.runtime.MapProxy<D,R>
All Implemented Interfaces:
Serializable, Map<D,R>
Direct Known Subclasses:
CheckedMap_D, CheckedMap_R, CheckedMap_RD

public class MapProxy<D,R> extends Object implements Map<D,R>, Serializable
Implements a map by delegation to some peer object from a predefined java runtime class. The kind of implementation (hash map or tree map) can be selected by a parameter to the constructor.

Is used for checked maps, therefore the "put" methods (etc.) are implemented in the sub-classes and treated here as "abstract".

See Also:
  • Field Details

    • peer

      protected Map<D,R> peer
  • Constructor Details

  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • asSorted

      public SortedMap<D,R> asSorted()
      Returns a sorted, unmodifiable view IFF the backing peer is a sorted map. This is currently only the case when the implementstion has been explicitly seelected as tree on creation.
      Throws:
      UnsupportedOperationException - if the backing peer does not offer a sorted view.
    • clear

      public void clear()
      Specified by:
      clear in interface Map<D,R>
    • containsKey

      public boolean containsKey(Object key)
      Specified by:
      containsKey in interface Map<D,R>
    • containsValue

      public boolean containsValue(Object value)
      Specified by:
      containsValue in interface Map<D,R>
    • entrySet

      public Set<Map.Entry<D,R>> entrySet()
      Will be overridden for R = range checked maps. java doc says "[Map.entrySet()} does not support the add or addAll operations"
      Specified by:
      entrySet in interface Map<D,R>
    • equals

      public boolean equals(Object o)
      Specified by:
      equals in interface Map<D,R>
      Overrides:
      equals in class Object
    • get

      public R get(Object key)
      Specified by:
      get in interface Map<D,R>
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface Map<D,R>
      Overrides:
      hashCode in class Object
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface Map<D,R>
    • keySet

      public Set<D> keySet()
      Specified by:
      keySet in interface Map<D,R>
    • put

      public R put(D key, R value)
      Is overridden by subclass to make non-null checks.
      Specified by:
      put in interface Map<D,R>
    • putAll

      public void putAll(Map<? extends D,? extends R> t)
      Is overridden by subclass to make non-null checks.
      Specified by:
      putAll in interface Map<D,R>
    • remove

      public R remove(Object key)
      Specified by:
      remove in interface Map<D,R>
    • size

      public int size()
      Specified by:
      size in interface Map<D,R>
    • values

      public Collection<R> values()
      Specified by:
      values in interface Map<D,R>