Top Description Constructors Methods
org.apache.avalon.framework.configuration

public abstract Class AbstractConfiguration

extends Object
implements Configuration
Class Inheritance
All Implemented Interfaces
org.apache.avalon.framework.configuration.Configuration
Known Direct Subclasses
org.apache.avalon.framework.configuration.DefaultConfiguration, org.apache.avalon.framework.configuration.DefaultImmutableConfiguration

This is an abstract Configuration implementation that deals with methods that can be abstracted away from underlying implementations.
Author
Avalon Development Team
Version
$Id: AbstractConfiguration.java 506231 2007-02-12 02:36:54Z crossley $

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

the value
getAttribute
(final String
the name of the attribute
name
,
final String
the default value to return if value malformed or empty
defaultValue
)

Implements org.apache.avalon.framework.configuration.Configuration.getAttribute.

Returns the value of the attribute specified by its name as a String.
public boolean

Returns:

the value
getAttributeAsBoolean
(final String
the name of the attribute
name
)

Implements org.apache.avalon.framework.configuration.Configuration.getAttributeAsBoolean.

Returns the value of the attribute specified by its name as a boolean.
public boolean

Returns:

the value
getAttributeAsBoolean
(final String
the name of the attribute
name
,
final boolean
the default value to return if value malformed or empty
defaultValue
)

Implements org.apache.avalon.framework.configuration.Configuration.getAttributeAsBoolean.

Returns the value of the attribute specified by its name as a boolean.
public double

Returns:

the value
getAttributeAsDouble
(final String
the name of the attribute
name
)

Implements org.apache.avalon.framework.configuration.Configuration.getAttributeAsDouble.

Returns the value of the attribute specified by its name as a double.
public double

Returns:

the value
getAttributeAsDouble
(final String
the name of the attribute
name
,
final double
the default value to return if value malformed or empty
defaultValue
)

Implements org.apache.avalon.framework.configuration.Configuration.getAttributeAsDouble.

Returns the value of the attribute specified by its name as a double.
public float

Returns:

the value
getAttributeAsFloat
(final String
the name of the attribute
name
)

Implements org.apache.avalon.framework.configuration.Configuration.getAttributeAsFloat.

Returns the value of the attribute specified by its name as a float.
public float

Returns:

the value
getAttributeAsFloat
(final String
the name of the attribute
name
,
final float
the default value to return if value malformed or empty
defaultValue
)

Implements org.apache.avalon.framework.configuration.Configuration.getAttributeAsFloat.

Returns the value of the attribute specified by its name as a float.
public int

Returns:

the value
getAttributeAsInteger
(final String
the name of the attribute
name
)

Implements org.apache.avalon.framework.configuration.Configuration.getAttributeAsInteger.

Returns the value of the attribute specified by its name as an int.
public int

Returns:

the value
getAttributeAsInteger
(final String
the name of the attribute
name
,
final int
the default value to return if value malformed or empty
defaultValue
)

Implements org.apache.avalon.framework.configuration.Configuration.getAttributeAsInteger.

Returns the value of the attribute specified by its name as an int.
public long

Returns:

the value
getAttributeAsLong
(final String
the name of the attribute
name
)

Implements org.apache.avalon.framework.configuration.Configuration.getAttributeAsLong.

Returns the value of the attribute specified by its name as a long.
public long

Returns:

the value
getAttributeAsLong
(final String
the name of the attribute
name
,
final long
the default value to return if value malformed or empty
defaultValue
)

Implements org.apache.avalon.framework.configuration.Configuration.getAttributeAsLong.

Returns the value of the attribute specified by its name as a long.
public Configuration

Returns:

the child Configuration
getChild
(final String
the name of the child
name
)

Implements org.apache.avalon.framework.configuration.Configuration.getChild.

Return the first Configuration object child of this associated with the given name.
public Configuration

Returns:

the child Configuration
getChild
(final String
the name of the child
name
,
final boolean
true if you want to create a new Configuration object if none exists
createNew
)

Implements org.apache.avalon.framework.configuration.Configuration.getChild.

Return the first Configuration object child of this associated with the given name.
protected abstract String

Returns:

A non-null String (defaults to "")
getPrefix
()

Returns the prefix of the namespace.

public String

Returns:

the value
getValue
(final String
the default value to return if value malformed or empty
defaultValue
)

Implements org.apache.avalon.framework.configuration.Configuration.getValue.

Returns the value of the configuration element as a String.
public boolean

Returns:

the value
getValueAsBoolean
()

Implements org.apache.avalon.framework.configuration.Configuration.getValueAsBoolean.

Returns the value of the configuration element as a boolean.
public boolean

Returns:

the value
getValueAsBoolean
(final boolean
the default value to return if value malformed or empty
defaultValue
)

Implements org.apache.avalon.framework.configuration.Configuration.getValueAsBoolean.

Returns the value of the configuration element as a boolean.
public double

Returns:

the value
getValueAsDouble
()

Implements org.apache.avalon.framework.configuration.Configuration.getValueAsDouble.

Returns the value of the configuration element as a double.
public double

Returns:

the value
getValueAsDouble
(final double
the default value to return if value malformed or empty
defaultValue
)

Implements org.apache.avalon.framework.configuration.Configuration.getValueAsDouble.

Returns the value of the configuration element as a double.
public float

Returns:

the value
getValueAsFloat
()

Implements org.apache.avalon.framework.configuration.Configuration.getValueAsFloat.

Returns the value of the configuration element as a float.
public float

Returns:

the value
getValueAsFloat
(final float
the default value to return if value malformed or empty
defaultValue
)

Implements org.apache.avalon.framework.configuration.Configuration.getValueAsFloat.

Returns the value of the configuration element as a float.
public int

Returns:

the value
getValueAsInteger
()

Implements org.apache.avalon.framework.configuration.Configuration.getValueAsInteger.

Returns the value of the configuration element as an int.
public int

Returns:

the value
getValueAsInteger
(final int
the default value to return if value malformed or empty
defaultValue
)

Implements org.apache.avalon.framework.configuration.Configuration.getValueAsInteger.

Returns the value of the configuration element as an int.
public long

Returns:

the value
getValueAsLong
()

Implements org.apache.avalon.framework.configuration.Configuration.getValueAsLong.

Returns the value of the configuration element as a long.
public long

Returns:

the value
getValueAsLong
(final long
the default value to return if value malformed or empty
defaultValue
)

Implements org.apache.avalon.framework.configuration.Configuration.getValueAsLong.

Returns the value of the configuration element as a long.
private boolean
isFalse(final String value)

private boolean
isTrue(final String value)

public String

Returns:

getName() + "::" + getValue() + ":@" + getLocation();
toString
()

Overrides java.lang.Object.toString.

The toString() operation is used for debugging information.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Constructor Detail

AbstractConfigurationback to summary
public AbstractConfiguration()

Method Detail

getAttributeback to summary
public String getAttribute(final String name, final String defaultValue)

Implements org.apache.avalon.framework.configuration.Configuration.getAttribute.

Returns the value of the attribute specified by its name as a String.

Parameters
name:String

the name of the attribute

defaultValue:String

the default value to return if value malformed or empty

Returns:String

the value

getAttributeAsBooleanback to summary
public boolean getAttributeAsBoolean(final String name) throws ConfigurationException

Implements org.apache.avalon.framework.configuration.Configuration.getAttributeAsBoolean.

Returns the value of the attribute specified by its name as a boolean.

Parameters
name:String

the name of the attribute

Returns:boolean

the value

Exceptions
ConfigurationException:
if an error occurs
getAttributeAsBooleanback to summary
public boolean getAttributeAsBoolean(final String name, final boolean defaultValue)

Implements org.apache.avalon.framework.configuration.Configuration.getAttributeAsBoolean.

Returns the value of the attribute specified by its name as a boolean.

Parameters
name:String

the name of the attribute

defaultValue:boolean

the default value to return if value malformed or empty

Returns:boolean

the value

getAttributeAsDoubleback to summary
public double getAttributeAsDouble(final String name) throws ConfigurationException

Implements org.apache.avalon.framework.configuration.Configuration.getAttributeAsDouble.

Returns the value of the attribute specified by its name as a double.

Parameters
name:String

the name of the attribute

Returns:double

the value

Exceptions
ConfigurationException:
if an error occurs
getAttributeAsDoubleback to summary
public double getAttributeAsDouble(final String name, final double defaultValue)

Implements org.apache.avalon.framework.configuration.Configuration.getAttributeAsDouble.

Returns the value of the attribute specified by its name as a double.

Parameters
name:String

the name of the attribute

defaultValue:double

the default value to return if value malformed or empty

Returns:double

the value

getAttributeAsFloatback to summary
public float getAttributeAsFloat(final String name) throws ConfigurationException

Implements org.apache.avalon.framework.configuration.Configuration.getAttributeAsFloat.

Returns the value of the attribute specified by its name as a float.

Parameters
name:String

the name of the attribute

Returns:float

the value

Exceptions
ConfigurationException:
if an error occurs
getAttributeAsFloatback to summary
public float getAttributeAsFloat(final String name, final float defaultValue)

Implements org.apache.avalon.framework.configuration.Configuration.getAttributeAsFloat.

Returns the value of the attribute specified by its name as a float.

Parameters
name:String

the name of the attribute

defaultValue:float

the default value to return if value malformed or empty

Returns:float

the value

getAttributeAsIntegerback to summary
public int getAttributeAsInteger(final String name) throws ConfigurationException

Implements org.apache.avalon.framework.configuration.Configuration.getAttributeAsInteger.

Returns the value of the attribute specified by its name as an int. Hexadecimal numbers begin with 0x, Octal numbers begin with 0o and binary numbers begin with 0b, all other values are assumed to be decimal.

Parameters
name:String

the name of the attribute

Returns:int

the value

Exceptions
ConfigurationException:
if an error occurs
getAttributeAsIntegerback to summary
public int getAttributeAsInteger(final String name, final int defaultValue)

Implements org.apache.avalon.framework.configuration.Configuration.getAttributeAsInteger.

Returns the value of the attribute specified by its name as an int. Hexadecimal numbers begin with 0x, Octal numbers begin with 0o and binary numbers begin with 0b, all other values are assumed to be decimal.

Parameters
name:String

the name of the attribute

defaultValue:int

the default value to return if value malformed or empty

Returns:int

the value

getAttributeAsLongback to summary
public long getAttributeAsLong(final String name) throws ConfigurationException

Implements org.apache.avalon.framework.configuration.Configuration.getAttributeAsLong.

Returns the value of the attribute specified by its name as a long. Hexadecimal numbers begin with 0x, Octal numbers begin with 0o and binary numbers begin with 0b, all other values are assumed to be decimal.

Parameters
name:String

the name of the attribute

Returns:long

the value

Exceptions
ConfigurationException:
if an error occurs
getAttributeAsLongback to summary
public long getAttributeAsLong(final String name, final long defaultValue)

Implements org.apache.avalon.framework.configuration.Configuration.getAttributeAsLong.

Returns the value of the attribute specified by its name as a long. Hexadecimal numbers begin with 0x, Octal numbers begin with 0o and binary numbers begin with 0b, all other values are assumed to be decimal.

Parameters
name:String

the name of the attribute

defaultValue:long

the default value to return if value malformed or empty

Returns:long

the value

getChildback to summary
public Configuration getChild(final String name)

Implements org.apache.avalon.framework.configuration.Configuration.getChild.

Return the first Configuration object child of this associated with the given name. If no such child exists, a new one will be created.

Parameters
name:String

the name of the child

Returns:Configuration

the child Configuration

getChildback to summary
public Configuration getChild(final String name, final boolean createNew)

Implements org.apache.avalon.framework.configuration.Configuration.getChild.

Return the first Configuration object child of this associated with the given name.

Parameters
name:String

the name of the child

createNew:boolean

true if you want to create a new Configuration object if none exists

Returns:Configuration

the child Configuration

getPrefixback to summary
protected abstract String getPrefix() throws ConfigurationException

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:String

A non-null String (defaults to "")

Exceptions
ConfigurationException:
if no prefix was defined (prefix is null.
Since
4.1
getValueback to summary
public String getValue(final String defaultValue)

Implements org.apache.avalon.framework.configuration.Configuration.getValue.

Returns the value of the configuration element as a String.

Parameters
defaultValue:String

the default value to return if value malformed or empty

Returns:String

the value

getValueAsBooleanback to summary
public boolean getValueAsBoolean() throws ConfigurationException

Implements org.apache.avalon.framework.configuration.Configuration.getValueAsBoolean.

Returns the value of the configuration element as a boolean.

Returns:boolean

the value

Exceptions
ConfigurationException:
if an error occurs
getValueAsBooleanback to summary
public boolean getValueAsBoolean(final boolean defaultValue)

Implements org.apache.avalon.framework.configuration.Configuration.getValueAsBoolean.

Returns the value of the configuration element as a boolean.

Parameters
defaultValue:boolean

the default value to return if value malformed or empty

Returns:boolean

the value

getValueAsDoubleback to summary
public double getValueAsDouble() throws ConfigurationException

Implements org.apache.avalon.framework.configuration.Configuration.getValueAsDouble.

Returns the value of the configuration element as a double.

Returns:double

the value

Exceptions
ConfigurationException:
if an error occurs
getValueAsDoubleback to summary
public double getValueAsDouble(final double defaultValue)

Implements org.apache.avalon.framework.configuration.Configuration.getValueAsDouble.

Returns the value of the configuration element as a double.

Parameters
defaultValue:double

the default value to return if value malformed or empty

Returns:double

the value

getValueAsFloatback to summary
public float getValueAsFloat() throws ConfigurationException

Implements org.apache.avalon.framework.configuration.Configuration.getValueAsFloat.

Returns the value of the configuration element as a float.

Returns:float

the value

Exceptions
ConfigurationException:
if an error occurs
getValueAsFloatback to summary
public float getValueAsFloat(final float defaultValue)

Implements org.apache.avalon.framework.configuration.Configuration.getValueAsFloat.

Returns the value of the configuration element as a float.

Parameters
defaultValue:float

the default value to return if value malformed or empty

Returns:float

the value

getValueAsIntegerback to summary
public int getValueAsInteger() throws ConfigurationException

Implements org.apache.avalon.framework.configuration.Configuration.getValueAsInteger.

Returns the value of the configuration element as an int. Hexadecimal numbers begin with 0x, Octal numbers begin with 0o and binary numbers begin with 0b, all other values are assumed to be decimal.

Returns:int

the value

Exceptions
ConfigurationException:
if an error occurs
getValueAsIntegerback to summary
public int getValueAsInteger(final int defaultValue)

Implements org.apache.avalon.framework.configuration.Configuration.getValueAsInteger.

Returns the value of the configuration element as an int. Hexadecimal numbers begin with 0x, Octal numbers begin with 0o and binary numbers begin with 0b, all other values are assumed to be decimal.

Parameters
defaultValue:int

the default value to return if value malformed or empty

Returns:int

the value

getValueAsLongback to summary
public long getValueAsLong() throws ConfigurationException

Implements org.apache.avalon.framework.configuration.Configuration.getValueAsLong.

Returns the value of the configuration element as a long. Hexadecimal numbers begin with 0x, Octal numbers begin with 0o and binary numbers begin with 0b, all other values are assumed to be decimal.

Returns:long

the value

Exceptions
ConfigurationException:
if an error occurs
getValueAsLongback to summary
public long getValueAsLong(final long defaultValue)

Implements org.apache.avalon.framework.configuration.Configuration.getValueAsLong.

Returns the value of the configuration element as a long. Hexadecimal numbers begin with 0x, Octal numbers begin with 0o and binary numbers begin with 0b, all other values are assumed to be decimal.

Parameters
defaultValue:long

the default value to return if value malformed or empty

Returns:long

the value

isFalseback to summary
private boolean isFalse(final String value)
isTrueback to summary
private boolean isTrue(final String value)
toStringback to summary
public String toString()

Overrides java.lang.Object.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.

Returns:String

getName() + "::" + getValue() + ":@" + getLocation();