|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.configuration.tree.DefaultConfigurationNode
public class DefaultConfigurationNode
A default implementation of the ConfigurationNode interface.
| Nested Class Summary | |
|---|---|
protected static class |
DefaultConfigurationNode.SubNodes
An internally used helper class for managing a collection of sub nodes. |
| Constructor Summary | |
|---|---|
DefaultConfigurationNode()
Creates a new uninitialized instance of DefaultConfigurationNode. |
|
DefaultConfigurationNode(String name)
Creates a new instance of DefaultConfigurationNode and
initializes it with the node name. |
|
DefaultConfigurationNode(String name,
Object value)
Creates a new instance of DefaultConfigurationNode and
initializes it with the name and a value. |
|
| Method Summary | |
|---|---|
void |
addAttribute(ConfigurationNode attr)
Adds the specified attribute to this node. |
void |
addChild(ConfigurationNode child)
Adds a new child to this node. |
protected void |
checkState()
Checks if a modification of this node is allowed. |
Object |
clone()
Creates a copy of this object. |
protected DefaultConfigurationNode.SubNodes |
createSubNodes(boolean attributes)
Creates a SubNodes instance that is used for storing
either this node's children or attributes. |
ConfigurationNode |
getAttribute(int index)
Returns the attribute with the given index. |
int |
getAttributeCount()
Returns the number of attributes contained in this node. |
int |
getAttributeCount(String name)
Returns the number of attributes of this node with the given name. |
List |
getAttributes()
Returns a list with the attributes of this node. |
List |
getAttributes(String name)
Returns a list with all attributes of this node with the given name. |
ConfigurationNode |
getChild(int index)
Returns the child node with the given index. |
List |
getChildren()
Returns a list with all children of this node. |
List |
getChildren(String name)
Returns a list of all children with the given name. |
int |
getChildrenCount()
Returns the number of all children of this node. |
int |
getChildrenCount(String name)
Returns the number of children with the given name. |
String |
getName()
Returns the name of this node. |
ConfigurationNode |
getParentNode()
Returns a reference to this node's parent. |
Object |
getReference()
Returns the reference. |
Object |
getValue()
Returns the value of this node. |
boolean |
isAttribute()
Checks if this node is an attribute node. |
boolean |
isDefined()
Returns a flag if this node is defined. |
boolean |
removeAttribute(ConfigurationNode node)
Removes the specified attribute. |
boolean |
removeAttribute(String name)
Removes all attributes with the specified name. |
void |
removeAttributes()
Removes all attributes of this node. |
boolean |
removeChild(ConfigurationNode child)
Removes the specified child node from this node. |
boolean |
removeChild(String childName)
Removes all children with the given name. |
void |
removeChildren()
Removes all child nodes of this node. |
protected void |
removeReference()
Deals with the reference when a node is removed. |
void |
setAttribute(boolean f)
Sets the attribute flag. |
void |
setName(String name)
Sets the name of this node. |
void |
setParentNode(ConfigurationNode parent)
Sets the parent of this node. |
void |
setReference(Object reference)
Sets the reference. |
void |
setValue(Object val)
Sets the value of this node. |
void |
visit(ConfigurationNodeVisitor visitor)
Visits this node and all its sub nodes. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DefaultConfigurationNode()
DefaultConfigurationNode.
public DefaultConfigurationNode(String name)
DefaultConfigurationNode and
initializes it with the node name.
name - the name of this node
public DefaultConfigurationNode(String name,
Object value)
DefaultConfigurationNode and
initializes it with the name and a value.
name - the node's namevalue - the node's value| Method Detail |
|---|
public String getName()
getName in interface ConfigurationNodepublic void setName(String name)
setName in interface ConfigurationNodename - the new namepublic Object getValue()
getValue in interface ConfigurationNodepublic void setValue(Object val)
setValue in interface ConfigurationNodeval - the value of this nodepublic Object getReference()
getReference in interface ConfigurationNodepublic void setReference(Object reference)
setReference in interface ConfigurationNodereference - the reference objectpublic ConfigurationNode getParentNode()
getParentNode in interface ConfigurationNodepublic void setParentNode(ConfigurationNode parent)
setParentNode in interface ConfigurationNodeparent - the parent of this nodepublic void addChild(ConfigurationNode child)
addChild in interface ConfigurationNodechild - the new childpublic List getChildren()
getChildren in interface ConfigurationNodepublic int getChildrenCount()
getChildrenCount in interface ConfigurationNodepublic List getChildren(String name)
getChildren in interface ConfigurationNodename - the name; can be null , then all children are returned
public int getChildrenCount(String name)
getChildrenCount in interface ConfigurationNodename - the name; can be null , then the number of all
children is returned
public ConfigurationNode getChild(int index)
getChild in interface ConfigurationNodeindex - the index (0-based)
public boolean removeChild(ConfigurationNode child)
removeChild in interface ConfigurationNodechild - the node to be removed
public boolean removeChild(String childName)
removeChild in interface ConfigurationNodechildName - the name of the children to be removed
public void removeChildren()
removeChildren in interface ConfigurationNodepublic boolean isAttribute()
isAttribute in interface ConfigurationNodepublic void setAttribute(boolean f)
setAttribute in interface ConfigurationNodef - the attribute flagpublic void addAttribute(ConfigurationNode attr)
addAttribute in interface ConfigurationNodeattr - the attribute to be addedpublic List getAttributes()
ConfigurationNode objects, too.
getAttributes in interface ConfigurationNodepublic int getAttributeCount()
getAttributeCount in interface ConfigurationNodepublic List getAttributes(String name)
getAttributes in interface ConfigurationNodename - the attribute's name
public int getAttributeCount(String name)
getAttributeCount in interface ConfigurationNodename - the name
public boolean removeAttribute(ConfigurationNode node)
removeAttribute in interface ConfigurationNodenode - the attribute node to be removed
public boolean removeAttribute(String name)
removeAttribute in interface ConfigurationNodename - the name
public ConfigurationNode getAttribute(int index)
getAttribute in interface ConfigurationNodeindex - the index (0-based)
public void removeAttributes()
removeAttributes in interface ConfigurationNodepublic boolean isDefined()
isDefined in interface ConfigurationNodepublic void visit(ConfigurationNodeVisitor visitor)
visit in interface ConfigurationNodevisitor - the visitorConfigurationNodeVisitorpublic Object clone()
clone in interface ConfigurationNodeclone in class Objectprotected void checkState()
protected DefaultConfigurationNode.SubNodes createSubNodes(boolean attributes)
SubNodes instance that is used for storing
either this node's children or attributes.
attributes - true if the returned instance is used for
storing attributes, false for storing child nodes
SubNodes object to useprotected void removeReference()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||