Class ConfigurationDynaBean

java.lang.Object
java.util.AbstractMap<Object,Object>
org.apache.commons.configuration2.ConfigurationMap
org.apache.commons.configuration2.beanutils.ConfigurationDynaBean
All Implemented Interfaces:
Map<Object,Object>, org.apache.commons.beanutils.DynaBean

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
  • Constructor Details

    • ConfigurationDynaBean

      public ConfigurationDynaBean(Configuration configuration)
      Constructs a new instance of ConfigurationDynaBean and sets the configuration this bean is associated with.
      Parameters:
      configuration - the configuration
  • Method Details

    • contains

      public boolean contains(String name, String key)
      Specified by:
      contains in interface org.apache.commons.beanutils.DynaBean
    • get

      public Object get(String name)
      Specified by:
      get in interface org.apache.commons.beanutils.DynaBean
    • get

      public Object get(String name, int index)
      Specified by:
      get in interface org.apache.commons.beanutils.DynaBean
    • get

      public Object get(String name, String key)
      Specified by:
      get in interface org.apache.commons.beanutils.DynaBean
    • getDynaClass

      public org.apache.commons.beanutils.DynaClass getDynaClass()
      Specified by:
      getDynaClass in interface org.apache.commons.beanutils.DynaBean
    • remove

      public void remove(String name, String key)
      Specified by:
      remove in interface org.apache.commons.beanutils.DynaBean
    • set

      public void set(String name, int index, Object value)
      Specified by:
      set in interface org.apache.commons.beanutils.DynaBean
    • set

      public void set(String name, Object value)
      Specified by:
      set in interface org.apache.commons.beanutils.DynaBean
    • set

      public void set(String name, String key, Object value)
      Specified by:
      set in interface org.apache.commons.beanutils.DynaBean