Class AbstractConfiguration
java.lang.Object
org.apache.avalon.framework.configuration.AbstractConfiguration
- All Implemented Interfaces:
Configuration
- Direct Known Subclasses:
DefaultConfiguration,DefaultImmutableConfiguration
This is an abstract
Configuration implementation that deals
with methods that can be abstracted away from underlying implementations.- Version:
- CVS $Revision: 1.31 $ $Date: 2004/02/11 14:34:25 $
- Author:
- Avalon Development Team
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAttribute(String name, String defaultValue) Returns the value of the attribute specified by its name as aString.booleangetAttributeAsBoolean(String name) Returns the value of the attribute specified by its name as aboolean.booleangetAttributeAsBoolean(String name, boolean defaultValue) Returns the value of the attribute specified by its name as aboolean.floatgetAttributeAsFloat(String name) Returns the value of the attribute specified by its name as afloat.floatgetAttributeAsFloat(String name, float defaultValue) Returns the value of the attribute specified by its name as afloat.intgetAttributeAsInteger(String name) Returns the value of the attribute specified by its name as anint.intgetAttributeAsInteger(String name, int defaultValue) Returns the value of the attribute specified by its name as anint.longgetAttributeAsLong(String name) Returns the value of the attribute specified by its name as along.longgetAttributeAsLong(String name, long defaultValue) Returns the value of the attribute specified by its name as along.Return the firstConfigurationobject child of this associated with the given name.Return the firstConfigurationobject child of this associated with the given name.protected abstract StringReturns the prefix of the namespace.Returns the value of the configuration element as aString.booleanReturns the value of the configuration element as aboolean.booleangetValueAsBoolean(boolean defaultValue) Returns the value of the configuration element as aboolean.floatReturns the value of the configuration element as afloat.floatgetValueAsFloat(float defaultValue) Returns the value of the configuration element as afloat.intReturns the value of the configuration element as anint.intgetValueAsInteger(int defaultValue) Returns the value of the configuration element as anint.longReturns the value of the configuration element as along.longgetValueAsLong(long defaultValue) Returns the value of the configuration element as along.toString()The toString() operation is used for debugging information.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.avalon.framework.configuration.Configuration
getAttribute, getAttributeNames, getChildren, getChildren, getLocation, getName, getNamespace, getValue
-
Constructor Details
-
AbstractConfiguration
public AbstractConfiguration()
-
-
Method Details
-
getPrefix
Returns the prefix of the namespace. This is only used as a serialization hint, therefore is not part of the client API. It should be included in all Configuration implementations though.- Returns:
- A non-null String (defaults to "")
- Throws:
ConfigurationException- if no prefix was defined (prefix isnull.- Since:
- 4.1
-
getValueAsInteger
Returns the value of the configuration element as anint. Hexadecimal numbers begin with 0x, Octal numbers begin with 0o and binary numbers begin with 0b, all other values are assumed to be decimal.- Specified by:
getValueAsIntegerin interfaceConfiguration- Returns:
- the value
- Throws:
ConfigurationException- if an error occurs
-
getValueAsInteger
public int getValueAsInteger(int defaultValue) Returns the value of the configuration element as anint. Hexadecimal numbers begin with 0x, Octal numbers begin with 0o and binary numbers begin with 0b, all other values are assumed to be decimal.- Specified by:
getValueAsIntegerin interfaceConfiguration- Parameters:
defaultValue- the default value to return if value malformed or empty- Returns:
- the value
-
getValueAsLong
Returns the value of the configuration element as along. Hexadecimal numbers begin with 0x, Octal numbers begin with 0o and binary numbers begin with 0b, all other values are assumed to be decimal.- Specified by:
getValueAsLongin interfaceConfiguration- Returns:
- the value
- Throws:
ConfigurationException- if an error occurs
-
getValueAsLong
public long getValueAsLong(long defaultValue) Returns the value of the configuration element as along. Hexadecimal numbers begin with 0x, Octal numbers begin with 0o and binary numbers begin with 0b, all other values are assumed to be decimal.- Specified by:
getValueAsLongin interfaceConfiguration- Parameters:
defaultValue- the default value to return if value malformed or empty- Returns:
- the value
-
getValueAsFloat
Returns the value of the configuration element as afloat.- Specified by:
getValueAsFloatin interfaceConfiguration- Returns:
- the value
- Throws:
ConfigurationException- if an error occurs
-
getValueAsFloat
public float getValueAsFloat(float defaultValue) Returns the value of the configuration element as afloat.- Specified by:
getValueAsFloatin interfaceConfiguration- Parameters:
defaultValue- the default value to return if value malformed or empty- Returns:
- the value
-
getValueAsBoolean
Returns the value of the configuration element as aboolean.- Specified by:
getValueAsBooleanin interfaceConfiguration- Returns:
- the value
- Throws:
ConfigurationException- if an error occurs
-
getValueAsBoolean
public boolean getValueAsBoolean(boolean defaultValue) Returns the value of the configuration element as aboolean.- Specified by:
getValueAsBooleanin interfaceConfiguration- Parameters:
defaultValue- the default value to return if value malformed or empty- Returns:
- the value
-
getValue
Returns the value of the configuration element as aString.- Specified by:
getValuein interfaceConfiguration- Parameters:
defaultValue- the default value to return if value malformed or empty- Returns:
- the value
-
getAttributeAsInteger
Returns the value of the attribute specified by its name as anint. Hexadecimal numbers begin with 0x, Octal numbers begin with 0o and binary numbers begin with 0b, all other values are assumed to be decimal.- Specified by:
getAttributeAsIntegerin interfaceConfiguration- Parameters:
name- the name of the attribute- Returns:
- the value
- Throws:
ConfigurationException- if an error occurs
-
getAttributeAsInteger
Returns the value of the attribute specified by its name as anint. Hexadecimal numbers begin with 0x, Octal numbers begin with 0o and binary numbers begin with 0b, all other values are assumed to be decimal.- Specified by:
getAttributeAsIntegerin interfaceConfiguration- Parameters:
name- the name of the attributedefaultValue- the default value to return if value malformed or empty- Returns:
- the value
-
getAttributeAsLong
Returns the value of the attribute specified by its name as along. Hexadecimal numbers begin with 0x, Octal numbers begin with 0o and binary numbers begin with 0b, all other values are assumed to be decimal.- Specified by:
getAttributeAsLongin interfaceConfiguration- Parameters:
name- the name of the attribute- Returns:
- the value
- Throws:
ConfigurationException- if an error occurs
-
getAttributeAsLong
Returns the value of the attribute specified by its name as along. Hexadecimal numbers begin with 0x, Octal numbers begin with 0o and binary numbers begin with 0b, all other values are assumed to be decimal.- Specified by:
getAttributeAsLongin interfaceConfiguration- Parameters:
name- the name of the attributedefaultValue- the default value to return if value malformed or empty- Returns:
- the value
-
getAttributeAsFloat
Returns the value of the attribute specified by its name as afloat.- Specified by:
getAttributeAsFloatin interfaceConfiguration- Parameters:
name- the name of the attribute- Returns:
- the value
- Throws:
ConfigurationException- if an error occurs
-
getAttributeAsFloat
Returns the value of the attribute specified by its name as afloat.- Specified by:
getAttributeAsFloatin interfaceConfiguration- Parameters:
name- the name of the attributedefaultValue- the default value to return if value malformed or empty- Returns:
- the value
-
getAttributeAsBoolean
Returns the value of the attribute specified by its name as aboolean.- Specified by:
getAttributeAsBooleanin interfaceConfiguration- Parameters:
name- the name of the attribute- Returns:
- the value
- Throws:
ConfigurationException- if an error occurs
-
getAttributeAsBoolean
Returns the value of the attribute specified by its name as aboolean.- Specified by:
getAttributeAsBooleanin interfaceConfiguration- Parameters:
name- the name of the attributedefaultValue- the default value to return if value malformed or empty- Returns:
- the value
-
getAttribute
Returns the value of the attribute specified by its name as aString.- Specified by:
getAttributein interfaceConfiguration- Parameters:
name- the name of the attributedefaultValue- the default value to return if value malformed or empty- Returns:
- the value
-
getChild
Return the firstConfigurationobject child of this associated with the given name. If no such child exists, a new one will be created.- Specified by:
getChildin interfaceConfiguration- Parameters:
name- the name of the child- Returns:
- the child Configuration
-
getChild
Return the firstConfigurationobject child of this associated with the given name.- Specified by:
getChildin interfaceConfiguration- Parameters:
name- the name of the childcreateNew- true if you want to create a new Configuration object if none exists- Returns:
- the child Configuration
-
toString
The toString() operation is used for debugging information. It does not create a deep reproduction of this configuration and all child configurations, instead it displays the name, value, and location.
-