org.apache.commons.configuration2.builder.combined

## Class ConfigurationDeclaration

- java.lang.Object
- - org.apache.commons.configuration2.beanutils.XMLBeanDeclaration
  - - org.apache.commons.configuration2.builder.combined.ConfigurationDeclaration

- All Implemented Interfaces:
    BeanDeclaration

      public class ConfigurationDeclaration
      extends XMLBeanDeclaration

  A specialized `BeanDeclaration` implementation that represents the declaration of a configuration source.

  Instances of this class are able to extract all information about a configuration source from the configuration definition file. The declaration of a configuration source is very similar to a bean declaration processed by `XMLBeanDeclaration`. There are very few differences, e.g. some reserved attributes like `optional` and `at`, and the fact that a bean factory is never needed.

  Since:
    2.0
  Version:
    $Id: ConfigurationDeclaration.java 1624601 2014-09-12 18:04:36Z oheger $

- - ### Field Summary

    - ### Fields inherited from class org.apache.commons.configuration2.beanutils.XMLBeanDeclaration

      `ATTR_BEAN_CLASS, ATTR_BEAN_FACTORY, ATTR_FACTORY_PARAM, ATTR_PREFIX, RESERVED_PREFIX`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ConfigurationDeclaration(CombinedConfigurationBuilder builder, HierarchicalConfiguration<?> config)` Creates a new instance of `ConfigurationDeclaration` and initializes it.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getAt()` Returns the value of the `at` attribute.
    `String` | `getBeanClassName()` Returns the bean's class name.
    `String` | `getBeanFactoryName()` Returns the name of the bean factory.
    `CombinedConfigurationBuilder` | `getConfigurationBuilder()` Returns the associated configuration builder.
    `String` | `getName()` Returns the name for the represented configuration source.
    `boolean` | `isForceCreate()` Returns a flag whether this configuration should always be created and added to the resulting combined configuration.
    `boolean` | `isOptional()` Returns a flag whether this is an optional configuration.
    `boolean` | `isReload()` Returns a flag whether a builder with reloading support should be created.
    `protected boolean` | `isReservedAttributeName(String name)` Checks if the specified attribute name is reserved and thus does not point to a property of the bean to be created.

    - ### Methods inherited from class org.apache.commons.configuration2.beanutils.XMLBeanDeclaration

      `getAttributeNames, getBeanFactoryParameter, getBeanProperties, getConfiguration, getConstructorArgs, getDefaultBeanClassName, getNestedBeanDeclarations, interpolate, isReservedChildName, isReservedName`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ConfigurationDeclaration

          public ConfigurationDeclaration(CombinedConfigurationBuilder builder,
                                          HierarchicalConfiguration<?> config)

      Creates a new instance of `ConfigurationDeclaration` and initializes it.
      Parameters:
        `builder` - the associated configuration builder
        `config` - the configuration this declaration is based onto

  - ### Method Detail

    - #### getConfigurationBuilder

          public CombinedConfigurationBuilder getConfigurationBuilder()

      Returns the associated configuration builder.
      Returns:
        the configuration builder

    - #### getAt

          public String getAt()

      Returns the value of the `at` attribute.
      Returns:
        the value of the `at` attribute (can be null)

    - #### isOptional

          public boolean isOptional()

      Returns a flag whether this is an optional configuration.
      Returns:
        a flag if this declaration points to an optional configuration

    - #### isForceCreate

          public boolean isForceCreate()

      Returns a flag whether this configuration should always be created and added to the resulting combined configuration. This flag is evaluated only for optional configurations whose normal creation has caused an error. If for such a configuration the `forceCreate` attribute is set and the corresponding configuration provider supports this mode, an empty configuration will be created and added to the resulting combined configuration.
      Returns:
        the value of the `forceCreate` attribute

    - #### isReload

          public boolean isReload()

      Returns a flag whether a builder with reloading support should be created. This may not be supported by all configuration builder providers.
      Returns:
        a flag whether a reloading builder should be created

    - #### getName

          public String getName()

      Returns the name for the represented configuration source. The name is optional, so this method can return null.
      Returns:
        the name of the associated configuration source or null

    - #### getBeanFactoryName

          public String getBeanFactoryName()

      Returns the name of the bean factory. For configuration source declarations always a reserved factory is used. This factory's name is returned by this implementation.
      Specified by:
        `getBeanFactoryName` in interface `BeanDeclaration`
      Overrides:
        `getBeanFactoryName` in class `XMLBeanDeclaration`
      Returns:
        the name of the bean factory

    - #### getBeanClassName

          public String getBeanClassName()

      Returns the bean's class name. This implementation will always return null.
      Specified by:
        `getBeanClassName` in interface `BeanDeclaration`
      Overrides:
        `getBeanClassName` in class `XMLBeanDeclaration`
      Returns:
        the name of the bean's class

    - #### isReservedAttributeName

          protected boolean isReservedAttributeName(String name)

      Checks if the specified attribute name is reserved and thus does not point to a property of the bean to be created. This method is called when processing the attributes of this bean declaration. It is then possible to ignore some attributes with a specific meaning. This implementation delegates to `XMLBeanDeclaration.isReservedName(String)`. This implementation checks for additional reserved attribute names. Note that in some cases the presence of other attribute names determine whether a name is reserved or not. For instance, per default the attribute `config-at` is reserved. However, if this attribute is not present, the attribute `at` is also considered as a reserved attribute. (This is mainly done for dealing with legacy configuration files supported by earlier versions of this library.)
      Overrides:
        `isReservedAttributeName` in class `XMLBeanDeclaration`
      Parameters:
        `name` - the name of the attribute to be checked
      Returns:
        a flag whether this name is reserved

Copyright © 2001–2015 The Apache Software Foundation. All rights reserved.