org.apache.myfaces.shared.util
Class SubKeyMap<V>

java.lang.Object
  extended by java.util.AbstractMap<String,V>
      extended by org.apache.myfaces.shared.util.SubKeyMap<V>
All Implemented Interfaces:
Map<String,V>

public final class SubKeyMap<V>
extends AbstractMap<String,V>

NOTE: Class copied from trinidad to be used on FlashImpl. Map that wraps another to provide an isolated namespace using a prefix. This is especially handy for storing properties on the session in a structured manner without putting them into a true "Map" - because storing in a Map breaks session failover. (Session failover won't trigger on mutations of contained objects.)

Note that there is a potential design flaw; if you create a SubKeyMap for "mypackage.foo" and for "mypackage.foo.bar", all the keys in the latter will actually show up in the former (prefixed by ".bar"). This "flaw" is actually relied on by PageFlowScopeMap (since it provides a handy way to clear out all descendents), so don't "fix" it!


Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
 
Constructor Summary
SubKeyMap(Map<String,Object> base, String prefix)
           
 
Method Summary
 boolean containsKey(Object key)
           
 Set<Map.Entry<String,V>> entrySet()
           
 V get(Object key)
           
 boolean isEmpty()
           
 V put(String key, V value)
           
 V remove(Object key)
           
 
Methods inherited from class java.util.AbstractMap
clear, clone, containsValue, equals, hashCode, keySet, putAll, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SubKeyMap

public SubKeyMap(Map<String,Object> base,
                 String prefix)
Method Detail

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Map<String,V>
Overrides:
isEmpty in class AbstractMap<String,V>

get

public V get(Object key)
Specified by:
get in interface Map<String,V>
Overrides:
get in class AbstractMap<String,V>

put

public V put(String key,
             V value)
Specified by:
put in interface Map<String,V>
Overrides:
put in class AbstractMap<String,V>

remove

public V remove(Object key)
Specified by:
remove in interface Map<String,V>
Overrides:
remove in class AbstractMap<String,V>

containsKey

public boolean containsKey(Object key)
Specified by:
containsKey in interface Map<String,V>
Overrides:
containsKey in class AbstractMap<String,V>

entrySet

public Set<Map.Entry<String,V>> entrySet()
Specified by:
entrySet in interface Map<String,V>
Specified by:
entrySet in class AbstractMap<String,V>


Copyright © 2015 The Apache Software Foundation. All rights reserved.