org.apache.commons.configuration2.builder.combined

## Class CombinedConfigurationBuilderProvider

- java.lang.Object
- - org.apache.commons.configuration2.builder.combined.BaseConfigurationBuilderProvider
  - - org.apache.commons.configuration2.builder.combined.CombinedConfigurationBuilderProvider

- All Implemented Interfaces:
    ConfigurationBuilderProvider

      public class CombinedConfigurationBuilderProvider
      extends BaseConfigurationBuilderProvider

  A specialized `ConfigurationBuilderProvider` implementation which deals with combined configuration builders.

  This class is used to support `<configuration>` elements in configuration definition files. The provider creates another `CombinedConfigurationBuilder` which inherits some of the properties from its parent builder.

  Since:
    2.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CombinedConfigurationBuilderProvider()` Creates a new instance of `CombinedConfigurationBuilderProvider`.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected BasicConfigurationBuilder<? extends Configuration>` | `createBuilder(ConfigurationDeclaration decl, Collection<BuilderParameters> params)` Creates a new, uninitialized instance of the builder class managed by this provider.
    `protected void` | `initializeParameterObjects(ConfigurationDeclaration decl, Collection<BuilderParameters> params)` Initializes the parameter objects with data stored in the current bean declaration.

    - ### Methods inherited from class org.apache.commons.configuration2.builder.combined.BaseConfigurationBuilderProvider

      `configureBuilder, createParameterObjects, determineBuilderClass, determineConfigurationClass, getBuilderClass, getConfigurationBuilder, getConfigurationClass, getParameterClasses, getReloadingBuilderClass, inheritParentBuilderProperties, isAllowFailOnInit`

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

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

- - ### Constructor Detail

    - #### CombinedConfigurationBuilderProvider

          public CombinedConfigurationBuilderProvider()

      Creates a new instance of `CombinedConfigurationBuilderProvider`.

  - ### Method Detail

    - #### createBuilder

          protected BasicConfigurationBuilder<? extends Configuration> createBuilder(ConfigurationDeclaration decl,
                                                                                     Collection<BuilderParameters> params)
                                                                              throws Exception

      Creates a new, uninitialized instance of the builder class managed by this provider. This implementation determines the builder class to be used by delegating to `determineBuilderClass()`. It then calls the constructor expecting the configuration class, the map with properties, and theallowFailOnInit flag. This implementation creates the result builder object directly, not using reflection. (The reflection-based approach of the base class does not work here because a combined configuration builder has constructors with a different signature.) It also performs some additional initializations.
      Overrides:
        `createBuilder` in class `BaseConfigurationBuilderProvider`
      Parameters:
        `decl` - the current `ConfigurationDeclaration`
        `params` - initialization parameters for the new builder object
      Returns:
        the newly created builder instance
      Throws:
        `Exception` - if an error occurs

    - #### initializeParameterObjects

          protected void initializeParameterObjects(ConfigurationDeclaration decl,
                                                    Collection<BuilderParameters> params)
                                             throws Exception

      Initializes the parameter objects with data stored in the current bean declaration. This method is called before the newly created builder instance is configured with the parameter objects. It maps attributes of the bean declaration to properties of parameter objects. In addition, it invokes the parent `CombinedConfigurationBuilder` so that the parameters object can inherit properties already defined for this builder. This implementation pre-fills basic parameters from the basic properties of the parent builder's result configuration.
      Overrides:
        `initializeParameterObjects` in class `BaseConfigurationBuilderProvider`
      Parameters:
        `decl` - the current `ConfigurationDeclaration`
        `params` - the collection with (uninitialized) parameter objects
      Throws:
        `Exception` - if an error occurs

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