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

public Class DefaultImmutableConfiguration

extends AbstractConfiguration
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Imports
java.io.Serializable, java.util.ArrayList, .HashMap

An immutable implementation of the Configuration interface.
Author
Avalon Development Team
Version
$Id: DefaultImmutableConfiguration.java 506231 2007-02-12 02:36:54Z crossley $

Field Summary

Modifier and TypeField and Description
protected static final Configuration[]
EMPTY_ARRAY

An empty (length zero) array of configuration objects.

private final HashMap<K, V>
private final ArrayList<E>
private final String
private final String
private final String
private final String
private final String

Constructor Summary

AccessConstructor and Description
public
DefaultImmutableConfiguration(Configuration
the Configuration to do a deep copy of.
config
)

Deep copy constructor.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if they are the same.
equals
(Object
The other configuration
other
)

Overrides java.lang.Object.equals.

Compare if this configuration is equal to another.
public String

Returns:

a String value
getAttribute
(final String
a String value
name
)

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

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

Returns:

a String[] value
getAttributeNames
()

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

Return an array of all attribute names.
public Configuration

Returns:

a Configuration value
getChild
(final String
a String value
name
,
final boolean
a boolean value
createNew
)

Overrides org.apache.avalon.framework.configuration.AbstractConfiguration.getChild.

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

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

Returns:

an int value
getChildCount
()

Return count of children.

public Configuration[]

Returns:

The child nodes with name
getChildren
()

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

Return an array of Configuration elements containing all node children.
public Configuration[]

Returns:

a Configuration[] value
getChildren
(final String
The name of the required children Configuration.
name
)

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

Return an array of Configuration objects children of this associated with the given name.
public String

Returns:

a String value
getLocation
()

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

Returns a description of location of element.
public String

Returns:

a String value
getName
()

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

Returns the name of this configuration element.
public String

Returns:

a String value
getNamespace
()

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

Returns the namespace of this configuration element
protected String

Returns:

a String value
getPrefix
()

Implements abstract org.apache.avalon.framework.configuration.AbstractConfiguration.getPrefix.

Returns the prefix of the namespace
public String

Returns:

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

Overrides org.apache.avalon.framework.configuration.AbstractConfiguration.getValue.

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

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

Returns:

a String value
getValue
()

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

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

Returns:

the hashcode.
hashCode
()

Overrides java.lang.Object.hashCode.

Obtaine the hashcode for this configuration.
Inherited from org.apache.avalon.framework.configuration.AbstractConfiguration:
getAttributegetAttributeAsBooleangetAttributeAsBooleangetAttributeAsDoublegetAttributeAsDoublegetAttributeAsFloatgetAttributeAsFloatgetAttributeAsIntegergetAttributeAsIntegergetAttributeAsLonggetAttributeAsLonggetChildgetValueAsBooleangetValueAsBooleangetValueAsDoublegetValueAsDoublegetValueAsFloatgetValueAsFloatgetValueAsIntegergetValueAsIntegergetValueAsLonggetValueAsLongtoString

Field Detail

EMPTY_ARRAYback to summary
protected static final Configuration[] EMPTY_ARRAY

An empty (length zero) array of configuration objects.

m_attributesback to summary
private final HashMap<K, V> m_attributes
m_childrenback to summary
private final ArrayList<E> m_children
m_locationback to summary
private final String m_location
m_nameback to summary
private final String m_name
m_namespaceback to summary
private final String m_namespace
m_prefixback to summary
private final String m_prefix
m_valueback to summary
private final String m_value

Constructor Detail

DefaultImmutableConfigurationback to summary
public DefaultImmutableConfiguration(Configuration config) throws ConfigurationException

Deep copy constructor.

Parameters
config:Configuration

the Configuration to do a deep copy of.

Exceptions
ConfigurationException:
if an error occurs when copying

Method Detail

equalsback to summary
public boolean equals(Object other)

Overrides java.lang.Object.equals.

Compare if this configuration is equal to another.

Parameters
other:Object

The other configuration

Returns:boolean

true if they are the same.

getAttributeback to summary
public String getAttribute(final String name) throws ConfigurationException

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

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

Parameters
name:String

a String value

Returns:String

a String value

Exceptions
ConfigurationException:
If the attribute is not present.
getAttributeNamesback to summary
public String[] getAttributeNames()

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

Return an array of all attribute names.

Returns:String[]

a String[] value

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

Overrides org.apache.avalon.framework.configuration.AbstractConfiguration.getChild.

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

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

Parameters
name:String

a String value

createNew:boolean

a boolean value

Returns:Configuration

a Configuration value

getChildCountback to summary
public int getChildCount()

Return count of children.

Returns:int

an int value

getChildrenback to summary
public Configuration[] getChildren()

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

Return an array of Configuration elements containing all node children.

Returns:Configuration[]

The child nodes with name

getChildrenback to summary
public Configuration[] getChildren(final String name)

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

Return an array of Configuration objects children of this associated with the given name.
The returned array may be empty but is never null.

Parameters
name:String

The name of the required children Configuration.

Returns:Configuration[]

a Configuration[] value

getLocationback to summary
public String getLocation()

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

Returns a description of location of element.

Returns:String

a String value

getNameback to summary
public String getName()

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

Returns the name of this configuration element.

Returns:String

a String value

getNamespaceback to summary
public String getNamespace() throws ConfigurationException

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

Returns the namespace of this configuration element

Returns:String

a String value

Exceptions
ConfigurationException:
if an error occurs
Since
4.1
getPrefixback to summary
protected String getPrefix() throws ConfigurationException

Implements abstract org.apache.avalon.framework.configuration.AbstractConfiguration.getPrefix.

Returns the prefix of the namespace

Returns:String

a String value

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

Overrides org.apache.avalon.framework.configuration.AbstractConfiguration.getValue.

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

a String value

getValueback to summary
public String getValue() throws ConfigurationException

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

Returns the value of the configuration element as a String.

Returns:String

a String value

Exceptions
ConfigurationException:
If the value is not present.
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Obtaine the hashcode for this configuration.

Returns:int

the hashcode.