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

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

All Implemented Interfaces:
  BeanFactory

Enclosing class:
  DefaultConfigurationBuilder

    static class DefaultConfigurationBuilder.FileExtensionConfigurationProvider

extends DefaultConfigurationBuilder.FileConfigurationProvider

A specialized configuration provider for file based configurations that can handle configuration sources whose concrete type depends on the extension of the file to be loaded. One example is the `properties` tag: if the file ends with ".xml" a XMLPropertiesConfiguration object must be created, otherwise a PropertiesConfiguration object.

Field Summary

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

Constructor Summary
`DefaultConfigurationBuilder.FileExtensionConfigurationProvider(Class matchingClass, Class defaultClass, String extension)` Creates a new instance of `FileExtensionConfigurationProvider` and initializes it.

Method Summary
`protected Object` `createBeanInstance(Class beanClass, BeanDeclaration data)` Creates the configuration object.

Methods inherited from class org.apache.commons.configuration.DefaultConfigurationBuilder.FileConfigurationProvider
`getConfiguration, initBeanInstance`

Methods inherited from class org.apache.commons.configuration.DefaultConfigurationBuilder.ConfigurationProvider
`getConfigurationClass, setConfigurationClass`

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

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

Constructor Detail

### DefaultConfigurationBuilder.FileExtensionConfigurationProvider

    public DefaultConfigurationBuilder.FileExtensionConfigurationProvider(Class matchingClass,
                                                                          Class defaultClass,
                                                                          String extension)

  Creates a new instance of `FileExtensionConfigurationProvider` and initializes it.

  Parameters:
    `matchingClass` - the class to be created when the file extension matches
    `defaultClass` - the class to be created when the file extension does not match
    `extension` - the file extension to be checked agains

Method Detail

### createBeanInstance

    protected Object createBeanInstance(Class beanClass,
                                        BeanDeclaration data)
                                 throws Exception

  Creates the configuration object. The class is determined by the file name's extension.

  Overrides:
    `createBeanInstance` in class `DefaultBeanFactory`
  Parameters:
    `beanClass` - the class
    `data` - the bean declaration
  Returns:
    the new bean
  Throws:
    `Exception` - if an error occurs

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