|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractMap
java.util.HashMap
org.apache.commons.chain.impl.ContextBase
public class ContextBase
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.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.util.AbstractMap |
|---|
AbstractMap.SimpleEntry, AbstractMap.SimpleImmutableEntry |
| Nested classes/interfaces inherited from interface java.util.Map |
|---|
Map.Entry |
| Constructor Summary | |
|---|---|
ContextBase()
Default, no argument constructor. |
|
ContextBase(Map map)
Initialize the contents of this Context by copying the
values from the specified Map. |
|
| Method Summary | |
|---|---|
void |
clear()
Override the default Map behavior to clear all keys and
values except those corresponding to JavaBeans properties. |
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. |
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. |
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. |
boolean |
isEmpty()
Override the default Map behavior to return
true if the underlying Map only contains
key-value pairs for local properties (if any). |
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. |
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. |
void |
putAll(Map map)
Override the default Map behavior to call the
put() method individually for each key-value pair
in the specified Map. |
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. |
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. |
| Methods inherited from class java.util.HashMap |
|---|
clone, containsKey, size |
| Methods inherited from class java.util.AbstractMap |
|---|
equals, hashCode, toString |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Map |
|---|
containsKey, equals, hashCode, size |
| Constructor Detail |
|---|
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.
map - Map whose key-value pairs are added
IllegalArgumentException - if an exception is thrown
writing a local property value
UnsupportedOperationException - if a local property does not
have a write method.| Method Detail |
|---|
public void clear()
Override the default Map behavior to clear all keys and
values except those corresponding to JavaBeans properties.
clear in interface Mapclear in class HashMappublic 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.
containsValue in interface MapcontainsValue in class HashMapvalue - the value look for in the context.
true if found in this context otherwise
false.
IllegalArgumentException - if a property getter
throws an exceptionpublic 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.
entrySet in interface MapentrySet in class HashMappublic 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.
get in interface Mapget in class HashMapkey - Key of the value to be returned
IllegalArgumentException - if an exception is thrown
reading this local property value
UnsupportedOperationException - if this local property does not
have a read method.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).
isEmpty in interface MapisEmpty in class HashMaptrue if this Context is empty, otherwise
false.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.
keySet in interface MapkeySet in class HashMap
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.
put in interface Mapput in class HashMapkey - Key of the value to be stored or replacedvalue - New value to be stored
IllegalArgumentException - if an exception is thrown
reading or wrting this local property value
UnsupportedOperationException - if this local property does not
have both a read method and a write methodpublic void putAll(Map map)
Override the default Map behavior to call the
put() method individually for each key-value pair
in the specified Map.
putAll in interface MapputAll in class HashMapmap - Map containing key-value pairs to store
(or replace)
IllegalArgumentException - if an exception is thrown
reading or wrting a local property value
UnsupportedOperationException - if a local property does not
have both a read method and a write methodpublic 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.
remove in interface Mapremove in class HashMapkey - Key to be removed
UnsupportedOperationException - if the specified
key matches the name of a local propertypublic 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.
values in interface Mapvalues in class HashMap
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||