Class PrefixMap<V>

  • All Implemented Interfaces:
    java.util.Map<java.lang.String,​V>

    public class PrefixMap<V>
    extends java.lang.Object
    implements java.util.Map<java.lang.String,​V>
    A map whose entries are stored in a parent map by prefixing the key names with a specific string.
    • 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
      PrefixMap​(java.util.Map<java.lang.String,​V> map, java.lang.String prefix)
      Create a map whose entries are stored in a parent map by prefixing the key names with a specific string.
    • 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<java.lang.String,​V>> entrySet()  
      V get​(java.lang.Object key)  
      java.lang.String getPrefix()
      Get the prefix that this map is applying.
      int hashCode()  
      boolean isEmpty()  
      java.util.Set<java.lang.String> keySet()  
      V put​(java.lang.String key, V value)  
      void putAll​(java.util.Map<? extends java.lang.String,​? extends V> t)  
      V remove​(java.lang.Object key)  
      int size()  
      java.util.Collection<V> values()  
      • Methods inherited from class java.lang.Object

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

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

      • PrefixMap

        public PrefixMap​(java.util.Map<java.lang.String,​V> map,
                         java.lang.String prefix)
        Create a map whose entries are stored in a parent map by prefixing the key names with a specific string.
        Parameters:
        map - the parent map
        prefix - the prefix with which to prefix the entries in the parent map
    • Method Detail

      • clear

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

        public java.lang.String getPrefix()
        Get the prefix that this map is applying. This is the value that was supplied to the constructor. This class reserves the right to return a String which is not reference equivalent to the given string.
        Returns:
        The prefix string, which may be a zero length string.
      • containsKey

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

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

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

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

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

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

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

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

        public void putAll​(java.util.Map<? extends java.lang.String,​? extends V> t)
        Specified by:
        putAll in interface java.util.Map<java.lang.String,​V>
      • remove

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

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

        public java.util.Collection<V> values()
        Specified by:
        values in interface java.util.Map<java.lang.String,​V>