Class MapWrapper<T,​E>

  • All Implemented Interfaces:
    java.util.Map<T,​E>
    Direct Known Subclasses:
    MapWrapper

    public abstract class MapWrapper<T,​E>
    extends java.lang.Object
    implements java.util.Map<T,​E>
    Wrap a map and call template methods on modification.
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface java.util.Map

        java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.Map<T,​E> delegate
      The delegate map.
    • Constructor Summary

      Constructors 
      Constructor Description
      MapWrapper​(java.util.Map<T,​E> delegate)
      Create a new collection wrapper.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()  
      boolean containsKey​(java.lang.Object key)  
      boolean containsValue​(java.lang.Object value)  
      protected void entriesAdded​(java.util.Set<java.util.Map.Entry<T,​E>> entries)
      Entries were added to the map.
      protected void entriesRemoved​(java.util.Set<java.util.Map.Entry<T,​E>> entries)
      Entries were removed from the map.
      protected abstract void entryAdded​(T key, E value)
      An entry was added to the map.
      protected abstract void entryChanged​(T key, E oldvalue, E newvalue)
      An entry was changed in the map.
      protected abstract void entryRemoved​(T key, E value)
      An entry was removed from the map.
      java.util.Set<java.util.Map.Entry<T,​E>> entrySet()  
      boolean equals​(java.lang.Object obj)
      Test if this object equals another.
      E get​(java.lang.Object key)  
      int hashCode()
      Get the hashcode of the object.
      boolean isEmpty()  
      java.util.Set<T> keySet()  
      E put​(T key, E value)  
      void putAll​(java.util.Map<? extends T,​? extends E> m)  
      E remove​(java.lang.Object key)  
      int size()  
      java.lang.String toString()
      Get the string representation.
      java.util.Collection<E> values()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Map

        compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
    • Field Detail

      • delegate

        protected java.util.Map<T,​E> delegate
        The delegate map.
    • Constructor Detail

      • MapWrapper

        public MapWrapper​(java.util.Map<T,​E> delegate)
        Create a new collection wrapper.
    • Method Detail

      • size

        public int size()
        Specified by:
        size in interface java.util.Map<T,​E>
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface java.util.Map<T,​E>
      • containsKey

        public boolean containsKey​(java.lang.Object key)
        Specified by:
        containsKey in interface java.util.Map<T,​E>
      • containsValue

        public boolean containsValue​(java.lang.Object value)
        Specified by:
        containsValue in interface java.util.Map<T,​E>
      • get

        public E get​(java.lang.Object key)
        Specified by:
        get in interface java.util.Map<T,​E>
      • put

        public E put​(T key,
                     E value)
        Specified by:
        put in interface java.util.Map<T,​E>
      • remove

        public E remove​(java.lang.Object key)
        Specified by:
        remove in interface java.util.Map<T,​E>
      • putAll

        public void putAll​(java.util.Map<? extends T,​? extends E> m)
        Specified by:
        putAll in interface java.util.Map<T,​E>
      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Map<T,​E>
      • keySet

        public java.util.Set<T> keySet()
        Specified by:
        keySet in interface java.util.Map<T,​E>
      • values

        public java.util.Collection<E> values()
        Specified by:
        values in interface java.util.Map<T,​E>
      • entrySet

        public java.util.Set<java.util.Map.Entry<T,​E>> entrySet()
        Specified by:
        entrySet in interface java.util.Map<T,​E>
      • hashCode

        public int hashCode()
        Get the hashcode of the object.
        Specified by:
        hashCode in interface java.util.Map<T,​E>
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        The hashcode.
      • equals

        public boolean equals​(java.lang.Object obj)
        Test if this object equals another.
        Specified by:
        equals in interface java.util.Map<T,​E>
        Overrides:
        equals in class java.lang.Object
        Parameters:
        obj - The other object.
        Returns:
        True, if equal.
      • toString

        public java.lang.String toString()
        Get the string representation.
        Overrides:
        toString in class java.lang.Object
        Returns:
        The string representation.
      • entryAdded

        protected abstract void entryAdded​(T key,
                                           E value)
        An entry was added to the map.
      • entryRemoved

        protected abstract void entryRemoved​(T key,
                                             E value)
        An entry was removed from the map.
      • entryChanged

        protected abstract void entryChanged​(T key,
                                             E oldvalue,
                                             E newvalue)
        An entry was changed in the map.
      • entriesAdded

        protected void entriesAdded​(java.util.Set<java.util.Map.Entry<T,​E>> entries)
        Entries were added to the map.
      • entriesRemoved

        protected void entriesRemoved​(java.util.Set<java.util.Map.Entry<T,​E>> entries)
        Entries were removed from the map.