org.jboss.jsfunit.context
Class NoNewEntryMap

java.lang.Object
  extended by org.jboss.jsfunit.context.NoNewEntryMap
All Implemented Interfaces:
Map

public class NoNewEntryMap
extends Object
implements Map

This Map copies all the entries of the wrapped Map into a new Map and disallows new entries while JSFServerSession.getManagedBeanValue() is running. The net effect is that any write-through capabilities (or other special features) of the wrapped Map are disabled. Also, put() will not create a new entry and will return null if the key does not exist. See http://jira.jboss.org/jira/browse/JSFUNIT-164

Since:
1.1
Author:
Stan Silvert

Nested Class Summary
static class NoNewEntryMap.NewEntryNotAllowedException
           
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Method Summary
 void clear()
           
 boolean containsKey(Object key)
           
 boolean containsValue(Object value)
           
 Set entrySet()
           
 Object get(Object key)
           
 boolean isEmpty()
           
 Set keySet()
           
 Object put(Object key, Object value)
          This method does not allow new values to be placed into the Map.
 void putAll(Map m)
           
 Object remove(Object key)
           
 void setELRunning(boolean isELRunning)
          JSFServerSession.getManagedBeanValue() calls this to disable creation of a new managed bean during EL resolution.
 int size()
           
 Collection values()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Method Detail

setELRunning

public void setELRunning(boolean isELRunning)
JSFServerSession.getManagedBeanValue() calls this to disable creation of a new managed bean during EL resolution.

Parameters:
isELRunning - Enable/disable creation of managed beans.

clear

public void clear()
Specified by:
clear in interface Map

containsKey

public boolean containsKey(Object key)
Specified by:
containsKey in interface Map

containsValue

public boolean containsValue(Object value)
Specified by:
containsValue in interface Map

entrySet

public Set entrySet()
Specified by:
entrySet in interface Map

get

public Object get(Object key)
Specified by:
get in interface Map

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Map

keySet

public Set keySet()
Specified by:
keySet in interface Map

put

public Object put(Object key,
                  Object value)
This method does not allow new values to be placed into the Map. If the Map does not already contain the key then it returns null. Otherwise, it returns the value already held in the Map.

Specified by:
put in interface Map
Parameters:
key - The Map key.
value - The value that will be thrown away.
Returns:
null if the key does not already exist, otherwise return the value already held in the Map.

putAll

public void putAll(Map m)
Specified by:
putAll in interface Map

remove

public Object remove(Object key)
Specified by:
remove in interface Map

size

public int size()
Specified by:
size in interface Map

values

public Collection values()
Specified by:
values in interface Map


Copyright © 2007-2010 JBoss, a division of Red Hat, Inc.. All Rights Reserved.