Decorates a
DynaBean to provide Map behaviour.
The motivation for this implementation is to provide access to
DynaBean properties in technologies that are unaware of BeanUtils and
DynaBean s -
such as the expression languages of JSTL and JSF.
This can be achieved either by wrapping the
DynaBean prior to
providing it to the technolody to process or by providing a Map
accessor method on the DynaBean implementation:
public Map getMap() {
return new DynaBeanMapDecorator(this);
}
This, for example, could be used in JSTL in the following way to access
a DynaBean's fooProperty :
${myDynaBean.map.fooProperty}
Usage
To decorate a
DynaBean simply instantiate this class with the
target
DynaBean :
Map fooMap = new DynaBeanMapDecorator(fooDynaBean);
The above example creates a read only Map .
To create a Map which can be modified, construct a
DynaBeanMapDecorator with the read only
attribute set to false :
Map fooMap = new DynaBeanMapDecorator(fooDynaBean, false);
Limitations
In this implementation the entrySet() , keySet()
and values() methods create an unmodifiable
Set and it does not support the Map's clear()
and remove() operations.
since: BeanUtils 1.8.0 version: $Revision: 546471 $ $Date: 2007-06-12 13:57:20 +0100 (Tue, 12 Jun 2007) $ |