org.apache.avalon.framework.configuration
public class DefaultConfiguration extends AbstractConfiguration implements MutableConfiguration, Serializable
Configuration
implementation.
Version: $Id: DefaultConfiguration.java 160878 2005-04-11 08:59:59 -0500 (Mon, 11 Apr 2005) leif $
Field Summary | |
---|---|
protected static Configuration[] | EMPTY_ARRAY
An empty (length zero) array of configuration objects. |
HashMap | m_attributes |
ArrayList | m_children |
String | m_location |
String | m_name |
String | m_namespace |
String | m_prefix |
boolean | m_readOnly |
String | m_value |
Constructor Summary | |
---|---|
DefaultConfiguration(Configuration config, boolean deepCopy)
Copy constructor, to create a clone of another configuration.
| |
DefaultConfiguration(Configuration config)
Shallow copy constructor, suitable for craeting a writable clone of
a read-only configuration. | |
DefaultConfiguration(String name)
Create a new DefaultConfiguration instance. | |
DefaultConfiguration(String name, String location)
Create a new DefaultConfiguration instance. | |
DefaultConfiguration(String name, String location, String ns, String prefix)
Create a new DefaultConfiguration instance. |
Method Summary | |
---|---|
void | addAll(Configuration other, boolean deepCopy)
Add all the attributes, children and value
from specified configuration element to current
configuration element.
|
void | addAll(Configuration other)
Add all the attributes, children and value
from specified configuration element to current
configuration element.
|
void | addAllAttributes(Configuration other)
Add all attributes from specified configuration
element to current configuration element.
|
void | addAllChildren(Configuration other, boolean deepCopy)
Add all child Configuration objects from specified
configuration element to current configuration element.
|
void | addAllChildren(Configuration other)
Add all child Configuration objects from specified
configuration element to current configuration element.
|
String | addAttribute(String name, String value)
Add an attribute to this configuration element, returning its old
value or null.
|
void | addChild(Configuration configuration)
Add a child Configuration to this configuration element. |
void | appendValueData(String value)
Append data to the value of this configuration element.
|
boolean | check(Object one, Object two) |
protected void | checkWriteable()
heck if this configuration is writeable.
|
boolean | equals(Object other)
Compare if this configuration is equal to another.
|
String | getAttribute(String name)
Returns the value of the attribute specified by its name as a
String .
|
String[] | getAttributeNames()
Return an array of all attribute names. |
Configuration | getChild(String name, boolean createNew)
Return the first Configuration object child of this
associated with the given name. |
int | getChildCount()
Return count of children. |
Configuration[] | getChildren()
Return an array of Configuration
elements containing all node children.
|
Configuration[] | getChildren(String name)
Return an array of Configuration objects
children of this associated with the given name.
|
String | getLocation()
Returns a description of location of element. |
MutableConfiguration | getMutableChild(String name) |
MutableConfiguration | getMutableChild(String name, boolean autoCreate) |
MutableConfiguration[] | getMutableChildren() |
MutableConfiguration[] | getMutableChildren(String name) |
String | getName()
Returns the name of this configuration element. |
String | getNamespace()
Returns the namespace of this configuration element |
protected String | getPrefix()
Returns the prefix of the namespace |
String | getValue(String defaultValue)
Returns the value of the configuration element as a String .
|
String | getValue()
Returns the value of the configuration element as a String .
|
int | hashCode()
Obtaine the hashcode for this configuration.
|
protected boolean | isReadOnly()
Returns true iff this DefaultConfiguration has been made read-only. |
void | makeReadOnly()
Make this configuration read-only.
|
void | removeChild(Configuration configuration)
Remove a child Configuration to this configuration element. |
void | setAttribute(String name, String value)
Set the value of the specified attribute to the specified string.
|
void | setAttribute(String name, int value)
Set the value of the specified attribute to the specified int.
|
void | setAttribute(String name, long value)
Set the value of the specified attribute to the specified long.
|
void | setAttribute(String name, boolean value)
Set the value of the specified attribute to the specified boolean.
|
void | setAttribute(String name, float value)
Set the value of the specified attribute to the specified float.
|
void | setAttribute(String name, double value)
Set the value of the specified attribute to the specified double.
|
void | setValue(String value)
Set the value of this Configuration object to the specified string.
|
void | setValue(int value)
Set the value of this Configuration object to the specified int.
|
void | setValue(long value)
Set the value of this Configuration object to the specified long.
|
void | setValue(boolean value)
Set the value of this Configuration object to the specified boolean.
|
void | setValue(float value)
Set the value of this Configuration object to the specified float.
|
void | setValue(double value)
Set the value of this Configuration object to the specified double.
|
MutableConfiguration | toMutable(Configuration child)
Convenience function to convert a child to a mutable configuration.
|
getChild()
,
removeChild()
and addChild()
.
Parameters: config the Configuration
to copy deepCopy true will cause clones of the children to be added,
false will add the original instances and is thus
faster.
Throws: ConfigurationException if an error occurs when copying
getChild()
,
removeChild()
and addChild()
.
Parameters: config the Configuration
to copy
Throws: ConfigurationException if an error occurs when copying
DefaultConfiguration
instance.Parameters: name a String
value
DefaultConfiguration
instance.Parameters: name a String
value location a String
value
DefaultConfiguration
instance.Parameters: name config node name location Builder-specific locator string ns Namespace string (typically a URI). Should not be null; use "" if no namespace. prefix A short string prefixed to element names, associating elements with a longer namespace string. Should not be null; use "" if no namespace.
Since: 4.1
Parameters: other the Configuration element deepCopy true will cause clones of the children to be added, false will add the original instances and is thus faster. throws ConfigurationException If there are any problems cloning the children.
Parameters: other the Configuration element
Parameters: other the Configuration element
Configuration
objects from specified
configuration element to current configuration element.
Parameters: deepCopy true will cause clones of the children to be added, false will add the original instances and is thus faster. other the other Configuration value throws ConfigurationException If there are any problems cloning the children.
Configuration
objects from specified
configuration element to current configuration element.
Parameters: other the other Configuration value
Deprecated: Use setAttribute() instead
Add an attribute to this configuration element, returning its old value or null.Parameters: name a String
value value a String
value
Returns: a String
value
Configuration
to this configuration element.Parameters: configuration a Configuration
value
Deprecated: Use setValue() instead
Append data to the value of this configuration element.Parameters: value a String
value
Throws: IllegalStateException if this configuration s read-only
Parameters: other The other configuration
Returns: true
if they are the same.
String
.
Parameters: name a String
value
Returns: a String
value
Throws: ConfigurationException If the attribute is not present.
Returns: a String[]
value
Configuration
object child of this
associated with the given name.Parameters: name a String
value createNew a boolean
value
Returns: a Configuration
value
Returns: an int
value
Configuration
elements containing all node children.
Returns: The child nodes with name
Configuration
objects
children of this associated with the given name.
null
.
Parameters: name The name of the required children Configuration
.
Returns: a Configuration[]
value
Returns: a String
value
Returns: a String
value
Returns: a String
value
Throws: ConfigurationException if an error occurs
Since: 4.1
Returns: a String
value
Throws: ConfigurationException if prefix is not present (null
).
Since: 4.1
String
.
Parameters: defaultValue the default value to return if value malformed or empty
Returns: a String
value
String
.
Returns: a String
value
Throws: ConfigurationException If the value is not present.
Returns: the hashcode.
Configuration
to this configuration element.Parameters: configuration a Configuration
value
Parameters: name name of the attribute to set value a String
value
Parameters: name name of the attribute to set value an int
value
Parameters: name name of the attribute to set value an long
value
Parameters: name name of the attribute to set value an boolean
value
Parameters: name name of the attribute to set value an float
value
Parameters: name name of the attribute to set value an double
value
Configuration
object to the specified string.
Parameters: value a String
value
Configuration
object to the specified int.
Parameters: value a int
value
Configuration
object to the specified long.
Parameters: value a long
value
Configuration
object to the specified boolean.
Parameters: value a boolean
value
Configuration
object to the specified float.
Parameters: value a float
value
Configuration
object to the specified double.
Parameters: value a double
value