Package org.apache.commons.configuration
Class DefaultConfigurationBuilder.ConfigurationDeclaration
- java.lang.Object
-
- org.apache.commons.configuration.beanutils.XMLBeanDeclaration
-
- org.apache.commons.configuration.DefaultConfigurationBuilder.ConfigurationDeclaration
-
- All Implemented Interfaces:
BeanDeclaration
- Enclosing class:
- DefaultConfigurationBuilder
public static class DefaultConfigurationBuilder.ConfigurationDeclaration extends XMLBeanDeclaration
A specialized
BeanDeclarationimplementation that represents the declaration of a configuration source.Instances of this class are able to extract all information about a configuration source from the configuration definition file. The declaration of a configuration source is very similar to a bean declaration processed by
XMLBeanDeclaration. There are very few differences, e.g. some reserved attributes likeoptionalandatand the fact that a bean factory is never needed.
-
-
Field Summary
-
Fields inherited from class org.apache.commons.configuration.beanutils.XMLBeanDeclaration
ATTR_BEAN_CLASS, ATTR_BEAN_FACTORY, ATTR_FACTORY_PARAM, ATTR_PREFIX, RESERVED_PREFIX
-
-
Constructor Summary
Constructors Constructor Description ConfigurationDeclaration(DefaultConfigurationBuilder builder, HierarchicalConfiguration config)Creates a new instance ofConfigurationDeclarationand initializes it.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetAt()Returns the value of theatattribute.java.lang.StringgetBeanClassName()Returns the bean's class name.java.lang.StringgetBeanFactoryName()Returns the name of the bean factory.DefaultConfigurationBuildergetConfigurationBuilder()Returns the associated configuration builder.protected java.lang.Objectinterpolate(java.lang.Object value)Performs interpolation.booleanisForceCreate()Returns a flag whether this configuration should always be created and added to the resulting combined configuration.booleanisOptional()Returns a flag whether this is an optional configuration.protected booleanisReservedNode(ConfigurationNode nd)Checks whether the given node is reserved.-
Methods inherited from class org.apache.commons.configuration.beanutils.XMLBeanDeclaration
createBeanDeclaration, getBeanFactoryParameter, getBeanProperties, getConfiguration, getNestedBeanDeclarations, getNode
-
-
-
-
Constructor Detail
-
ConfigurationDeclaration
public ConfigurationDeclaration(DefaultConfigurationBuilder builder, HierarchicalConfiguration config)
Creates a new instance ofConfigurationDeclarationand initializes it.- Parameters:
builder- the associated configuration builderconfig- the configuration this declaration is based onto
-
-
Method Detail
-
getConfigurationBuilder
public DefaultConfigurationBuilder getConfigurationBuilder()
Returns the associated configuration builder.- Returns:
- the configuration builder
-
getAt
public java.lang.String getAt()
Returns the value of theatattribute.- Returns:
- the value of the
atattribute (can be null)
-
isOptional
public boolean isOptional()
Returns a flag whether this is an optional configuration.- Returns:
- a flag if this declaration points to an optional configuration
-
isForceCreate
public boolean isForceCreate()
Returns a flag whether this configuration should always be created and added to the resulting combined configuration. This flag is evaluated only for optional configurations whose normal creation has caused an error. If for such a configuration theforceCreateattribute is set and the corresponding configuration provider supports this mode, an empty configuration will be created and added to the resulting combined configuration.- Returns:
- the value of the
forceCreateattribute - Since:
- 1.4
-
getBeanFactoryName
public java.lang.String getBeanFactoryName()
Returns the name of the bean factory. For configuration source declarations always a reserved factory is used. This factory's name is returned by this implementation.- Specified by:
getBeanFactoryNamein interfaceBeanDeclaration- Overrides:
getBeanFactoryNamein classXMLBeanDeclaration- Returns:
- the name of the bean factory
-
getBeanClassName
public java.lang.String getBeanClassName()
Returns the bean's class name. This implementation will always return null.- Specified by:
getBeanClassNamein interfaceBeanDeclaration- Overrides:
getBeanClassNamein classXMLBeanDeclaration- Returns:
- the name of the bean's class
-
isReservedNode
protected boolean isReservedNode(ConfigurationNode nd)
Checks whether the given node is reserved. This method will take further reserved attributes into account- Overrides:
isReservedNodein classXMLBeanDeclaration- Parameters:
nd- the node- Returns:
- a flag whether this node is reserved
-
interpolate
protected java.lang.Object interpolate(java.lang.Object value)
Performs interpolation. This implementation will delegate interpolation to the configuration builder, which takes care that the currently constructed configuration is taken into account, too.- Overrides:
interpolatein classXMLBeanDeclaration- Parameters:
value- the value to be interpolated- Returns:
- the interpolated value
-
-