Class CmsConstantMap<K,​V>

  • Type Parameters:
    K - the type of keys maintained by this map
    V - the type of mapped values
    All Implemented Interfaces:
    java.util.Map<K,​V>

    public class CmsConstantMap<K,​V>
    extends java.lang.Object
    implements java.util.Map<K,​V>
    Returns the constant Object the map was initialized with for all get(Object) calls, regardless of what the actual key is.

    Since:
    7.0.2
    • 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>
    • Constructor Summary

      Constructors 
      Constructor Description
      CmsConstantMap​(V constant)
      Creates a new constant Map.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()  
      boolean containsKey​(java.lang.Object key)  
      boolean containsValue​(java.lang.Object value)  
      java.util.Set<java.util.Map.Entry<K,​V>> entrySet()  
      boolean equals​(java.lang.Object obj)  
      V get​(java.lang.Object key)  
      int hashCode()  
      boolean isEmpty()  
      java.util.Set<K> keySet()  
      V put​(java.lang.Object arg0, java.lang.Object arg1)  
      void putAll​(java.util.Map<? extends K,​? extends V> arg0)  
      V remove​(java.lang.Object key)  
      int size()  
      java.util.Collection<V> values()  
      • Methods inherited from class java.lang.Object

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

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

      • CONSTANT_BOOLEAN_FALSE_MAP

        public static final java.util.Map<java.lang.String,​java.lang.Boolean> CONSTANT_BOOLEAN_FALSE_MAP
        Constant Map that always returns Boolean.FALSE.
      • CONSTANT_BOOLEAN_TRUE_MAP

        public static final java.util.Map<java.lang.String,​java.lang.Boolean> CONSTANT_BOOLEAN_TRUE_MAP
        Constant Map that always returns Boolean.TRUE.
      • CONSTANT_EMPTY_STRING_MAP

        public static final java.util.Map<java.lang.String,​java.lang.String> CONSTANT_EMPTY_STRING_MAP
        Constant Map that always returns an empty list.
    • Constructor Detail

      • CmsConstantMap

        public CmsConstantMap​(V constant)
        Creates a new constant Map.

        Parameters:
        constant - the constant to return for all get(Object) calls.

    • Method Detail

      • clear

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

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

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

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

        public boolean equals​(java.lang.Object obj)
        Specified by:
        equals in interface java.util.Map<K,​V>
        Overrides:
        equals in class java.lang.Object
        See Also:
        Object.equals(java.lang.Object)
      • get

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

        public int hashCode()
        Specified by:
        hashCode in interface java.util.Map<K,​V>
        Overrides:
        hashCode in class java.lang.Object
        See Also:
        Object.hashCode()
      • isEmpty

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

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

        public V put​(java.lang.Object arg0,
                     java.lang.Object arg1)
        Specified by:
        put in interface java.util.Map<K,​V>
        See Also:
        Map.put(java.lang.Object, java.lang.Object)
      • putAll

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

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

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

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