DynaBeanPropertyMapDecorator instead. When adding
generics it turned out that it was not possible to use the correct type
parameters without breaking backwards compatibility. Therefore, class
DynaBeanPropertyMapDecorator was introduced as a replacement.@Deprecated public class DynaBeanMapDecorator extends BaseDynaBeanMapDecorator<Object>
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 DynaBeans -
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}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);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.
For reasons of backwards compatibility, the generic types of this
Map implementation are <Object, Object>. However, the
keys of the map are typically strings.
| Constructor and Description |
|---|
DynaBeanMapDecorator(DynaBean dynaBean)
Deprecated.
Constructs a read only Map for the specified
DynaBean. |
DynaBeanMapDecorator(DynaBean dynaBean,
boolean readOnly)
Deprecated.
Construct a Map for the specified
DynaBean. |
| Modifier and Type | Method and Description |
|---|---|
protected Object |
convertKey(String propertyName)
Deprecated.
Converts the name of a property to the key type of this decorator.
|
clear, containsKey, containsValue, entrySet, get, getDynaBean, isEmpty, isReadOnly, keySet, put, putAll, remove, size, valuesclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcompute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAllpublic DynaBeanMapDecorator(DynaBean dynaBean, boolean readOnly)
DynaBean.dynaBean - The dyna bean being decoratedreadOnly - true if the Map is read only
otherwise falseIllegalArgumentException - if the DynaBean is null.public DynaBeanMapDecorator(DynaBean dynaBean)
DynaBean.dynaBean - The dyna bean being decoratedIllegalArgumentException - if the DynaBean is null.protected Object convertKey(String propertyName)
BaseDynaBeanMapDecoratorconvertKey in class BaseDynaBeanMapDecorator<Object>propertyName - the name of a propertyCopyright © 2000–2019 The Apache Software Foundation. All rights reserved.