Class ConfigurationDynaBean
java.lang.Object
java.util.AbstractMap<Object,Object>
org.apache.commons.configuration2.ConfigurationMap
org.apache.commons.configuration2.beanutils.ConfigurationDynaBean
public class ConfigurationDynaBean
extends ConfigurationMap
implements org.apache.commons.beanutils.DynaBean
The
ConfigurationDynaBean
dynamically reads and writes configurations properties from a wrapped
configuration-collection Configuration
instance. It also implements a
Map
interface so that it can be used in JSP 2.0 Expression Language expressions.
The ConfigurationDynaBean
maps nested and mapped properties to the appropriate Configuration
subset
using the Configuration.subset(java.lang.String)
method. Similarly, indexed properties
reference lists of configuration properties using the
ImmutableConfiguration.getList(String)
method. Setting an indexed property is
supported, too.
Note: Some of the methods expect that a dot (".") is used as property delimiter for the wrapped configuration. This is true for most of the default configurations. Hierarchical configurations, for which a specific expression engine is set, may cause problems.
- Since:
- 1.0-rc1
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,
V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final org.apache.commons.logging.Log
The logger.private static final String
Constant for the property delimiter. -
Constructor Summary
ConstructorsConstructorDescriptionConfigurationDynaBean
(Configuration configuration) Constructs a new instance ofConfigurationDynaBean
and sets the configuration this bean is associated with. -
Method Summary
Modifier and TypeMethodDescriptionprivate boolean
checkIndexedProperty
(String name) Checks whether the given name references an indexed property.boolean
org.apache.commons.beanutils.DynaClass
void
void
void
void
Methods inherited from class org.apache.commons.configuration2.ConfigurationMap
entrySet, get, getConfiguration, put
Methods inherited from class java.util.AbstractMap
clear, clone, containsKey, containsValue, equals, hashCode, isEmpty, keySet, putAll, remove, size, toString, values
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
PROPERTY_DELIMITER
Constant for the property delimiter.- See Also:
-
LOG
private static final org.apache.commons.logging.Log LOGThe logger.
-
-
Constructor Details
-
ConfigurationDynaBean
Constructs a new instance ofConfigurationDynaBean
and sets the configuration this bean is associated with.- Parameters:
configuration
- the configuration
-
-
Method Details
-
set
- Specified by:
set
in interfaceorg.apache.commons.beanutils.DynaBean
-
get
- Specified by:
get
in interfaceorg.apache.commons.beanutils.DynaBean
-
contains
- Specified by:
contains
in interfaceorg.apache.commons.beanutils.DynaBean
-
get
- Specified by:
get
in interfaceorg.apache.commons.beanutils.DynaBean
-
get
- Specified by:
get
in interfaceorg.apache.commons.beanutils.DynaBean
-
getDynaClass
public org.apache.commons.beanutils.DynaClass getDynaClass()- Specified by:
getDynaClass
in interfaceorg.apache.commons.beanutils.DynaBean
-
remove
- Specified by:
remove
in interfaceorg.apache.commons.beanutils.DynaBean
-
set
- Specified by:
set
in interfaceorg.apache.commons.beanutils.DynaBean
-
set
- Specified by:
set
in interfaceorg.apache.commons.beanutils.DynaBean
-
checkIndexedProperty
Checks whether the given name references an indexed property. This implementation tests for properties of type list or array. If the property does not exist, an exception is thrown.- Parameters:
name
- the name of the property to check- Returns:
- a flag whether this is an indexed property
- Throws:
IllegalArgumentException
- if the property does not exist
-