Class MapContext<K,​V>

  • All Implemented Interfaces:
    java.util.Map<K,​V>, LocalizedMap<V>
    Direct Known Subclasses:
    MapStack, MultivaluedMapContext

    public class MapContext<K,​V>
    extends java.lang.Object
    implements java.util.Map<K,​V>, LocalizedMap<V>
    Map Context Provide a combined view for a collection of maps which are organized in a deque. All write operations affect only the head of the deque.
    • 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.Deque<java.util.Map<K,​V>> contexts  
      static java.lang.String module  
    • Constructor Summary

      Constructors 
      Constructor Description
      MapContext()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addToBottom​(java.util.Map<K,​V> existingMap)
      Puts an existing Map on the BOTTOM of the stack (bottom meaning will be overriden by lower layers on the stack, ie everything else already there)
      void clear()  
      boolean containsKey​(java.lang.Object key)  
      boolean containsValue​(java.lang.Object value)  
      java.util.Set<java.util.Map.Entry<K,​V>> entrySet()  
      V get​(java.lang.Object key)  
      V get​(java.lang.String name, java.util.Locale locale)  
      boolean isEmpty()  
      java.util.Set<K> keySet()  
      java.util.Map<K,​V> pop()
      Remove and returns the Map from the top of the stack; if there is only one Map on the stack it returns null and does not remove it
      void push()
      Puts a new Map on the top of the stack
      void push​(java.util.Map<K,​V> existingMap)
      Puts an existing Map on the top of the stack (top meaning will override lower layers on the stack)
      V put​(K key, V value)  
      void putAll​(java.util.Map<? extends K,​? extends V> arg0)  
      V remove​(java.lang.Object key)  
      int size()  
      java.lang.String toString()  
      java.util.Collection<V> values()  
      • Methods inherited from class java.lang.Object

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

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

      • module

        public static final java.lang.String module
      • contexts

        protected java.util.Deque<java.util.Map<K,​V>> contexts
    • Constructor Detail

      • MapContext

        public MapContext()
    • Method Detail

      • push

        public void push()
        Puts a new Map on the top of the stack
      • push

        public void push​(java.util.Map<K,​V> existingMap)
        Puts an existing Map on the top of the stack (top meaning will override lower layers on the stack)
      • addToBottom

        public void addToBottom​(java.util.Map<K,​V> existingMap)
        Puts an existing Map on the BOTTOM of the stack (bottom meaning will be overriden by lower layers on the stack, ie everything else already there)
      • pop

        public java.util.Map<K,​V> pop()
        Remove and returns the Map from the top of the stack; if there is only one Map on the stack it returns null and does not remove it
      • size

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

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

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

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

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

        public V get​(java.lang.String name,
                     java.util.Locale locale)
        Specified by:
        get in interface LocalizedMap<K>
      • put

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

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

        public void putAll​(java.util.Map<? extends K,​? extends V> arg0)
        Specified by:
        putAll in interface java.util.Map<K,​V>
      • clear

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

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

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

        public java.util.Set<java.util.Map.Entry<K,​V>> entrySet()
        Specified by:
        entrySet in interface java.util.Map<K,​V>
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object