Class DefaultImmutableConfiguration
java.lang.Object
org.apache.avalon.framework.configuration.AbstractConfiguration
org.apache.avalon.framework.configuration.DefaultImmutableConfiguration
- All Implemented Interfaces:
Serializable, org.apache.avalon.framework.configuration.Configuration
An immutable implementation of the
Configuration interface.- Version:
- $Id: DefaultImmutableConfiguration.java 30977 2004-07-30 03:57:54 -0500 (Fri, 30 Jul 2004) niclas $
- Author:
- Avalon Development Team
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final org.apache.avalon.framework.configuration.Configuration[]An empty (length zero) array of configuration objects.private final HashMapprivate final ArrayListprivate final Stringprivate final Stringprivate final Stringprivate final Stringprivate final String -
Constructor Summary
ConstructorsConstructorDescriptionDefaultImmutableConfiguration(org.apache.avalon.framework.configuration.Configuration config) Deep copy constructor. -
Method Summary
Modifier and TypeMethodDescriptionbooleanCompare if this configuration is equal to another.getAttribute(String name) Returns the value of the attribute specified by its name as aString.String[]Return an array of all attribute names.org.apache.avalon.framework.configuration.ConfigurationReturn the firstConfigurationobject child of this associated with the given name.intReturn count of children.org.apache.avalon.framework.configuration.Configuration[]Return an array ofConfigurationelements containing all node children.org.apache.avalon.framework.configuration.Configuration[]getChildren(String name) Return an array ofConfigurationobjects children of this associated with the given name.Returns a description of location of element.getName()Returns the name of this configuration element.Returns the namespace of this configuration elementprotected StringReturns the prefix of the namespacegetValue()Returns the value of the configuration element as aString.Returns the value of the configuration element as aString.inthashCode()Obtaine the hashcode for this configuration.Methods inherited from class AbstractConfiguration
getAttribute, getAttributeAsBoolean, getAttributeAsBoolean, getAttributeAsDouble, getAttributeAsDouble, getAttributeAsFloat, getAttributeAsFloat, getAttributeAsInteger, getAttributeAsInteger, getAttributeAsLong, getAttributeAsLong, getChild, getValueAsBoolean, getValueAsBoolean, getValueAsDouble, getValueAsDouble, getValueAsFloat, getValueAsFloat, getValueAsInteger, getValueAsInteger, getValueAsLong, getValueAsLong, toString
-
Field Details
-
EMPTY_ARRAY
protected static final org.apache.avalon.framework.configuration.Configuration[] EMPTY_ARRAYAn empty (length zero) array of configuration objects. -
m_name
-
m_location
-
m_namespace
-
m_prefix
-
m_attributes
-
m_children
-
m_value
-
-
Constructor Details
-
DefaultImmutableConfiguration
public DefaultImmutableConfiguration(org.apache.avalon.framework.configuration.Configuration config) throws org.apache.avalon.framework.configuration.ConfigurationException Deep copy constructor.- Parameters:
config- theConfigurationto do a deep copy of.- Throws:
org.apache.avalon.framework.configuration.ConfigurationException- if an error occurs when copying
-
-
Method Details
-
getName
Returns the name of this configuration element.- Specified by:
getNamein interfaceorg.apache.avalon.framework.configuration.Configuration- Returns:
- a
Stringvalue
-
getNamespace
public String getNamespace() throws org.apache.avalon.framework.configuration.ConfigurationExceptionReturns the namespace of this configuration element- Specified by:
getNamespacein interfaceorg.apache.avalon.framework.configuration.Configuration- Returns:
- a
Stringvalue - Throws:
org.apache.avalon.framework.configuration.ConfigurationException- if an error occurs- Since:
- 4.1
-
getPrefix
protected String getPrefix() throws org.apache.avalon.framework.configuration.ConfigurationExceptionReturns the prefix of the namespace- Specified by:
getPrefixin classAbstractConfiguration- Returns:
- a
Stringvalue - Throws:
org.apache.avalon.framework.configuration.ConfigurationException- if prefix is not present (null).- Since:
- 4.1
-
getLocation
Returns a description of location of element.- Specified by:
getLocationin interfaceorg.apache.avalon.framework.configuration.Configuration- Returns:
- a
Stringvalue
-
getValue
Returns the value of the configuration element as aString.- Specified by:
getValuein interfaceorg.apache.avalon.framework.configuration.Configuration- Overrides:
getValuein classAbstractConfiguration- Parameters:
defaultValue- the default value to return if value malformed or empty- Returns:
- a
Stringvalue
-
getValue
Returns the value of the configuration element as aString.- Specified by:
getValuein interfaceorg.apache.avalon.framework.configuration.Configuration- Returns:
- a
Stringvalue - Throws:
org.apache.avalon.framework.configuration.ConfigurationException- If the value is not present.
-
getAttributeNames
Return an array of all attribute names.- Specified by:
getAttributeNamesin interfaceorg.apache.avalon.framework.configuration.Configuration- Returns:
- a
String[]value
-
getChildren
public org.apache.avalon.framework.configuration.Configuration[] getChildren()Return an array ofConfigurationelements containing all node children.- Specified by:
getChildrenin interfaceorg.apache.avalon.framework.configuration.Configuration- Returns:
- The child nodes with name
-
getAttribute
public String getAttribute(String name) throws org.apache.avalon.framework.configuration.ConfigurationException Returns the value of the attribute specified by its name as aString.- Specified by:
getAttributein interfaceorg.apache.avalon.framework.configuration.Configuration- Parameters:
name- aStringvalue- Returns:
- a
Stringvalue - Throws:
org.apache.avalon.framework.configuration.ConfigurationException- If the attribute is not present.
-
getChild
public org.apache.avalon.framework.configuration.Configuration getChild(String name, boolean createNew) Return the firstConfigurationobject child of this associated with the given name.- Specified by:
getChildin interfaceorg.apache.avalon.framework.configuration.Configuration- Overrides:
getChildin classAbstractConfiguration- Parameters:
name- aStringvaluecreateNew- abooleanvalue- Returns:
- a
Configurationvalue
-
getChildren
Return an array ofConfigurationobjects children of this associated with the given name.
The returned array may be empty but is nevernull.- Specified by:
getChildrenin interfaceorg.apache.avalon.framework.configuration.Configuration- Parameters:
name- The name of the required childrenConfiguration.- Returns:
- a
Configuration[]value
-
getChildCount
public int getChildCount()Return count of children.- Returns:
- an
intvalue
-
equals
-
hashCode
-