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.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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
matchesdefaultClass
- the class to be created when the file extension
does not matchextension
- the file extension to be checked agains
DefaultConfigurationBuilder.FileExtensionConfigurationProvider
public DefaultConfigurationBuilder.FileExtensionConfigurationProvider(String matchingClassName,
String defaultClassName,
String extension)
- Creates a new instance of
FileExtensionConfigurationProvider
and initializes it
with the names of the classes to be created.
- Parameters:
matchingClassName
- the name of the class to be created when the
file extension matchesdefaultClassName
- the name of the class to be created when the
file extension does not matchextension
- the file extension to be checked agains- Since:
- 1.4
fetchMatchingClass
protected Class fetchMatchingClass()
throws Exception
- Returns the matching class object, no matter whether it was defined
as a class or as a class name.
- Returns:
- the matching class object
- Throws:
Exception
- if an error occurs- Since:
- 1.4
fetchDefaultClass
protected Class fetchDefaultClass()
throws Exception
- Returns the default class object, no matter whether it was defined as
a class or as a class name.
- Returns:
- the default class object
- Throws:
Exception
- if an error occurs- Since:
- 1.4
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 classdata
- the bean declaration
- Returns:
- the new bean
- Throws:
Exception
- if an error occurs
Copyright © 2001-2007 The Apache Software Foundation. All Rights Reserved.