org.ofbiz.base.util.collections
Class MapStack<K>

java.lang.Object
  extended by org.ofbiz.base.util.collections.MapStack<K>
All Implemented Interfaces:
java.util.Map<K,java.lang.Object>, LocalizedMap<java.lang.Object>

public class MapStack<K>
extends java.lang.Object
implements java.util.Map<K,java.lang.Object>, LocalizedMap<java.lang.Object>

Map Stack


Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Field Summary
protected static  mapStackFactory
           
static java.lang.String module
           
protected  java.util.List<java.util.Map<K,java.lang.Object>> stackList
           
 
Constructor Summary
protected MapStack()
           
 
Method Summary
 void addToBottom(java.util.Map<K,java.lang.Object> 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)
           
static
<K> MapStack<K>
create()
           
static
<K> MapStack<K>
create(java.util.Map<K,java.lang.Object> baseMap)
           
static
<K> MapStack<K>
create(MapStack<K> source)
          Does a shallow copy of the internal stack of the passed MapStack; enables simultaneous stacks that share common parent Maps
 java.util.Set<java.util.Map.Entry<K,java.lang.Object>> entrySet()
           
 java.lang.Object get(java.lang.Object key)
           
 java.lang.Object get(java.lang.String name, java.util.Locale locale)
           
protected static
<K> MapStack<K>
getMapStack()
           
 boolean isEmpty()
           
 java.util.Set<K> keySet()
           
 java.util.Map<K,java.lang.Object> 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,java.lang.Object> existingMap)
          Puts an existing Map on the top of the stack (top meaning will override lower layers on the stack)
 java.lang.Object put(K key, java.lang.Object value)
           
 void putAll(java.util.Map<? extends K,? extends java.lang.Object> arg0)
           
 java.lang.Object remove(java.lang.Object key)
           
 void reset()
           
 int size()
           
 MapStack<K> standAloneChildStack()
          Creates a MapStack object that has the same Map objects on its stack, but with a new Map pushed on the top; meant to be used to enable a situation where a parent and child context are operating simultaneously using two different MapStack objects, but sharing the Maps in common
 MapStack<K> standAloneStack()
          Creates a MapStack object that has the same Map objects on its stack; meant to be used to enable a situation where a parent and child context are operating simultaneously using two different MapStack objects, but sharing the Maps in common
 java.lang.String toString()
           
 java.util.Collection<java.lang.Object> 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
equals, hashCode
 

Field Detail

module

public static final java.lang.String module

mapStackFactory

protected static final  mapStackFactory

stackList

protected java.util.List<java.util.Map<K,java.lang.Object>> stackList
Constructor Detail

MapStack

protected MapStack()
Method Detail

getMapStack

protected static final <K> MapStack<K> getMapStack()

create

public static <K> MapStack<K> create()

create

public static <K> MapStack<K> create(java.util.Map<K,java.lang.Object> baseMap)

create

public static <K> MapStack<K> create(MapStack<K> source)
Does a shallow copy of the internal stack of the passed MapStack; enables simultaneous stacks that share common parent Maps


reset

public void reset()

push

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


push

public void push(java.util.Map<K,java.lang.Object> 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,java.lang.Object> 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,java.lang.Object> 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


standAloneStack

public MapStack<K> standAloneStack()
Creates a MapStack object that has the same Map objects on its stack; meant to be used to enable a situation where a parent and child context are operating simultaneously using two different MapStack objects, but sharing the Maps in common


standAloneChildStack

public MapStack<K> standAloneChildStack()
Creates a MapStack object that has the same Map objects on its stack, but with a new Map pushed on the top; meant to be used to enable a situation where a parent and child context are operating simultaneously using two different MapStack objects, but sharing the Maps in common


size

public int size()
Specified by:
size in interface java.util.Map<K,java.lang.Object>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Map<K,java.lang.Object>

containsKey

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

containsValue

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

get

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

get

public java.lang.Object get(java.lang.String name,
                            java.util.Locale locale)
Specified by:
get in interface LocalizedMap<java.lang.Object>

put

public java.lang.Object put(K key,
                            java.lang.Object value)
Specified by:
put in interface java.util.Map<K,java.lang.Object>

remove

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

putAll

public void putAll(java.util.Map<? extends K,? extends java.lang.Object> arg0)
Specified by:
putAll in interface java.util.Map<K,java.lang.Object>

clear

public void clear()
Specified by:
clear in interface java.util.Map<K,java.lang.Object>

keySet

public java.util.Set<K> keySet()
Specified by:
keySet in interface java.util.Map<K,java.lang.Object>

values

public java.util.Collection<java.lang.Object> values()
Specified by:
values in interface java.util.Map<K,java.lang.Object>

entrySet

public java.util.Set<java.util.Map.Entry<K,java.lang.Object>> entrySet()
Specified by:
entrySet in interface java.util.Map<K,java.lang.Object>

toString

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