Home » commons-chain-1.2-src » org.apache.commons » chain » impl » [javadoc | source]
org.apache.commons.chain.impl
public class: ContextBase [javadoc | source]
java.lang.Object
   java.util.AbstractMap
      java.util.HashMap
         org.apache.commons.chain.impl.ContextBase

All Implemented Interfaces:
    Context, Map, Serializable, Cloneable

Direct Known Subclasses:
    ServletWebContext, FacesWebContext, TestContext, WebContext, PortletWebContext

Convenience base class for Context implementations.

In addition to the minimal functionality required by the Context interface, this class implements the recommended support for Attribute-Property Transparency. This is implemented by analyzing the available JavaBeans properties of this class (or its subclass), exposes them as key-value pairs in the Map, with the key being the name of the property itself.

IMPLEMENTATION NOTE - Because empty is a read-only property defined by the Map interface, it may not be utilized as an attribute key or property name.

Constructor:
 public ContextBase() 
 public ContextBase(Map map) 

    Initialize the contents of this Context by copying the values from the specified Map. Any keys in map that correspond to local properties will cause the setter method for that property to be called.

    Parameters:
    map - Map whose key-value pairs are added
    Throws:
    IllegalArgumentException - if an exception is thrown writing a local property value
    UnsupportedOperationException - if a local property does not have a write method.
    exception: IllegalArgumentException - if an exception is thrown writing a local property value
    exception: UnsupportedOperationException - if a local property does not have a write method.
Method from org.apache.commons.chain.impl.ContextBase Summary:
clear,   containsValue,   entrySet,   get,   isEmpty,   keySet,   put,   putAll,   remove,   values
Methods from java.util.HashMap:
clear,   clone,   containsKey,   containsValue,   entrySet,   get,   isEmpty,   keySet,   put,   putAll,   remove,   size,   values
Methods from java.util.AbstractMap:
clear,   containsKey,   containsValue,   entrySet,   equals,   get,   hashCode,   isEmpty,   keySet,   put,   putAll,   remove,   size,   toString,   values
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.commons.chain.impl.ContextBase Detail:
 public  void clear() 

    Override the default Map behavior to clear all keys and values except those corresponding to JavaBeans properties.

 public boolean containsValue(Object value) 

    Override the default Map behavior to return true if the specified value is present in either the underlying Map or one of the local property values.

 public Set entrySet() 

    Override the default Map behavior to return a Set that meets the specified default behavior except for attempts to remove the key for a property of the Context implementation class, which will throw UnsupportedOperationException.

 public Object get(Object key) 

    Override the default Map behavior to return the value of a local property if the specified key matches a local property name.

    IMPLEMENTATION NOTE - If the specified key identifies a write-only property, null will arbitrarily be returned, in order to avoid difficulties implementing the contracts of the Map interface.

 public boolean isEmpty() 

    Override the default Map behavior to return true if the underlying Map only contains key-value pairs for local properties (if any).

 public Set keySet() 

    Override the default Map behavior to return a Set that meets the specified default behavior except for attempts to remove the key for a property of the Context implementation class, which will throw UnsupportedOperationException.

 public Object put(Object key,
    Object value) 

    Override the default Map behavior to set the value of a local property if the specified key matches a local property name.

 public  void putAll(Map map) 

    Override the default Map behavior to call the put() method individually for each key-value pair in the specified Map.

 public Object remove(Object key) 

    Override the default Map behavior to throw UnsupportedOperationException on any attempt to remove a key that is the name of a local property.

 public Collection values() 

    Override the default Map behavior to return a Collection that meets the specified default behavior except for attempts to remove the key for a property of the Context implementation class, which will throw UnsupportedOperationException.