|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.avalon.framework.configuration.AbstractConfiguration | +--org.apache.avalon.framework.configuration.DefaultConfiguration
This is the default Configuration
implementation.
Field Summary | |
protected static Configuration[] |
EMPTY_ARRAY
An empty (length zero) array of configuration objects. |
Constructor Summary | |
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)
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)
Add all child Configuration objects from specified
configuration element to current configuration element. |
String |
addAttribute(String name,
String value)
Deprecated. Use setAttribute() instead |
void |
addChild(Configuration configuration)
Add a child Configuration to this configuration element. |
void |
appendValueData(String value)
Deprecated. Use setValue() instead |
protected void |
checkWriteable()
heck if this configuration is writeable. |
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. |
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()
Returns the value of the configuration element as a String . |
String |
getValue(String defaultValue)
Returns the value of the configuration element as a String . |
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 |
setValue(String value)
Set the value of this Configuration object to the specified string. |
Methods inherited from class org.apache.avalon.framework.configuration.AbstractConfiguration |
getAttribute, getAttributeAsBoolean, getAttributeAsBoolean, getAttributeAsFloat, getAttributeAsFloat, getAttributeAsInteger, getAttributeAsInteger, getAttributeAsLong, getAttributeAsLong, getChild, getValueAsBoolean, getValueAsBoolean, getValueAsFloat, getValueAsFloat, getValueAsInteger, getValueAsInteger, getValueAsLong, getValueAsLong |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final Configuration[] EMPTY_ARRAY
Constructor Detail |
public DefaultConfiguration(String name)
DefaultConfiguration
instance.
name
- a String
valuepublic DefaultConfiguration(String name, String location)
DefaultConfiguration
instance.
name
- a String
valuelocation
- a String
valuepublic DefaultConfiguration(String name, String location, String ns, String prefix)
DefaultConfiguration
instance.
name
- config node namelocation
- Builder-specific locator stringns
- 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.Method Detail |
public String getName()
getName
in interface Configuration
String
valuepublic String getNamespace() throws ConfigurationException
getNamespace
in interface Configuration
String
value
ConfigurationException
- if an error occursprotected String getPrefix() throws ConfigurationException
getPrefix
in class AbstractConfiguration
String
value
ConfigurationException
- if prefix is not present (null
).public String getLocation()
getLocation
in interface Configuration
String
valuepublic String getValue(String defaultValue)
String
.
getValue
in interface Configuration
getValue
in class AbstractConfiguration
defaultValue
- the default value to return if value malformed or empty
String
valuepublic String getValue() throws ConfigurationException
String
.
getValue
in interface Configuration
String
value
ConfigurationException
- If the value is not present.public String[] getAttributeNames()
getAttributeNames
in interface Configuration
String[]
valuepublic Configuration[] getChildren()
Configuration
elements containing all node children.
getChildren
in interface Configuration
public String getAttribute(String name) throws ConfigurationException
String
.
getAttribute
in interface Configuration
name
- a String
value
String
value
ConfigurationException
- If the attribute is not present.public Configuration getChild(String name, boolean createNew)
Configuration
object child of this
associated with the given name.
getChild
in interface Configuration
getChild
in class AbstractConfiguration
name
- a String
valuecreateNew
- a boolean
value
Configuration
valuepublic Configuration[] getChildren(String name)
Configuration
objects
children of this associated with the given name.
null
.
getChildren
in interface Configuration
name
- The name of the required children Configuration
.
Configuration[]
valuepublic void appendValueData(String value)
value
- a String
valuepublic void setValue(String value)
Configuration
object to the specified string.
value
- a String
valuepublic void setAttribute(String name, String value)
name
- name of the attribute to setvalue
- a String
valuepublic String addAttribute(String name, String value)
name
- a String
valuevalue
- a String
value
String
valuepublic void addChild(Configuration configuration)
Configuration
to this configuration element.
configuration
- a Configuration
valuepublic void addAll(Configuration other)
other
- the Configuration
elementpublic void addAllAttributes(Configuration other)
other
- the Configuration
elementpublic void addAllChildren(Configuration other)
Configuration
objects from specified
configuration element to current configuration element.
other
- the other Configuration
valuepublic void removeChild(Configuration configuration)
Configuration
to this configuration element.
configuration
- a Configuration
valuepublic int getChildCount()
int
valuepublic void makeReadOnly()
protected final void checkWriteable() throws IllegalStateException
IllegalStateException
- if this configuration s read-only
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |