## org.apache.commons.configuration
Class DefaultConfigurationBuilder.ConfigurationProvider

    java.lang.Object
      org.apache.commons.configuration.beanutils.DefaultBeanFactory
          org.apache.commons.configuration.DefaultConfigurationBuilder.ConfigurationProvider

All Implemented Interfaces:
  BeanFactory

Direct Known Subclasses:
  DefaultConfigurationBuilder.ConfigurationBuilderProvider, DefaultConfigurationBuilder.FileConfigurationProvider

Enclosing class:
  DefaultConfigurationBuilder

    public static class DefaultConfigurationBuilder.ConfigurationProvider

extends DefaultBeanFactory

A base class for creating and initializing configuration sources.

Concrete sub classes of this base class are responsible for creating specific `Configuration` objects for the tags in the configuration definition file. The configuration factory will parse the definition file and try to find a matching `ConfigurationProvider` for each encountered tag. This provider is then asked to create a corresponding `Configuration` object. It is up to a concrete implementation how this object is created and initialized.

Note that at the moment only configuration classes derived from ``AbstractConfiguration`` are supported.

Field Summary

Fields inherited from class org.apache.commons.configuration.beanutils.DefaultBeanFactory
`INSTANCE`

Constructor Summary
`DefaultConfigurationBuilder.ConfigurationProvider()` Creates a new uninitialized instance of `ConfigurationProvider`.
`DefaultConfigurationBuilder.ConfigurationProvider(Class configClass)` Creates a new instance of `ConfigurationProvider` and sets the class of the configuration created by this provider.

Method Summary
`AbstractConfiguration` `getConfiguration(DefaultConfigurationBuilder.ConfigurationDeclaration decl)` Returns the configuration.
`Class` `getConfigurationClass()` Returns the class of the configuration returned by this provider.
`void` `setConfigurationClass(Class configurationClass)` Sets the class of the configuration returned by this provider.

Methods inherited from class org.apache.commons.configuration.beanutils.DefaultBeanFactory
`createBean, createBeanInstance, getDefaultBeanClass, initBeanInstance`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DefaultConfigurationBuilder.ConfigurationProvider

    public DefaultConfigurationBuilder.ConfigurationProvider()

  Creates a new uninitialized instance of `ConfigurationProvider`.

### DefaultConfigurationBuilder.ConfigurationProvider

    public DefaultConfigurationBuilder.ConfigurationProvider(Class configClass)

  Creates a new instance of `ConfigurationProvider` and sets the class of the configuration created by this provider.

  Parameters:
    `configClass` - the configuration class

Method Detail

### getConfigurationClass

    public Class getConfigurationClass()

  Returns the class of the configuration returned by this provider.

  Returns:
    the class of the provided configuration

### setConfigurationClass

    public void setConfigurationClass(Class configurationClass)

  Sets the class of the configuration returned by this provider.

  Parameters:
    `configurationClass` - the configuration class

### getConfiguration

    public AbstractConfiguration getConfiguration(DefaultConfigurationBuilder.ConfigurationDeclaration decl)
                                           throws Exception

  Returns the configuration. This method is called to fetch the configuration from the provider. This implementation will call the inherited ``createBean()`` method to create a new instance of the configuration class.

  Parameters:
    `decl` - the bean declaration with initialization parameters for the configuration
  Returns:
    the new configuration object
  Throws:
    `Exception` - if an error occurs

Copyright © 2001-2006 The Apache Software Foundation. All Rights Reserved.