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.
INSTANCE
Constructor and Description |
---|
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. |
DefaultConfigurationBuilder.ConfigurationProvider(String configClassName)
Creates a new instance of
ConfigurationProvider and
sets the name of the class of the configuration created by this
provider. |
Modifier and Type | Method and Description |
---|---|
protected Class<?> |
fetchConfigurationClass()
Returns the configuration class supported by this provider.
|
AbstractConfiguration |
getConfiguration(DefaultConfigurationBuilder.ConfigurationDeclaration decl)
Returns the configuration.
|
Class<?> |
getConfigurationClass()
Returns the class of the configuration returned by this provider.
|
String |
getConfigurationClassName()
Returns the name of the configuration class returned by this
provider.
|
AbstractConfiguration |
getEmptyConfiguration(DefaultConfigurationBuilder.ConfigurationDeclaration decl)
Returns an uninitialized configuration of the represented type.
|
protected Class<?> |
loadClass(String className)
Loads the class with the specified name dynamically.
|
void |
setConfigurationClass(Class<?> configurationClass)
Sets the class of the configuration returned by this provider.
|
void |
setConfigurationClassName(String configurationClassName)
Sets the name of the configuration class returned by this provider.
|
createBean, createBeanInstance, getDefaultBeanClass, initBeanInstance
public DefaultConfigurationBuilder.ConfigurationProvider()
ConfigurationProvider
.public DefaultConfigurationBuilder.ConfigurationProvider(Class<?> configClass)
ConfigurationProvider
and
sets the class of the configuration created by this provider.configClass
- the configuration classpublic DefaultConfigurationBuilder.ConfigurationProvider(String configClassName)
ConfigurationProvider
and
sets the name of the class of the configuration created by this
provider.configClassName
- the name of the configuration classpublic Class<?> getConfigurationClass()
public void setConfigurationClass(Class<?> configurationClass)
configurationClass
- the configuration classpublic String getConfigurationClassName()
public void setConfigurationClassName(String configurationClassName)
configurationClassName
- the name of the configuration classpublic AbstractConfiguration getConfiguration(DefaultConfigurationBuilder.ConfigurationDeclaration decl) throws Exception
createBean()
method to create a new instance of the
configuration class.decl
- the bean declaration with initialization parameters for
the configurationException
- if an error occurspublic AbstractConfiguration getEmptyConfiguration(DefaultConfigurationBuilder.ConfigurationDeclaration decl) throws Exception
getConfiguration()
method caused an error and the
forceCreate
attribute is set. A concrete sub class can
here try to create an uninitialized, empty configuration, which may
be possible if the error was created during initialization. This base
implementation just returns null.decl
- the bean declaration with initialization parameters for
the configurationException
- if an error occursprotected Class<?> fetchConfigurationClass() throws Exception
Exception
protected Class<?> loadClass(String className) throws ClassNotFoundException
className
- the name of the class to be loadedClassNotFoundException
- if class loading failsCopyright © 2001–2013 The Apache Software Foundation. All rights reserved.