public class DefaultConfigurationNode extends Object implements ConfigurationNode, Cloneable
 A default implementation of the ConfigurationNode interface.
 
| Modifier and Type | Class and Description | 
|---|---|
| protected static class  | DefaultConfigurationNode.SubNodesAn internally used helper class for managing a collection of sub nodes. | 
| Constructor and Description | 
|---|
| DefaultConfigurationNode()Creates a new uninitialized instance of  DefaultConfigurationNode. | 
| DefaultConfigurationNode(String name)Creates a new instance of  DefaultConfigurationNodeand
 initializes it with the node name. | 
| DefaultConfigurationNode(String name,
                        Object value)Creates a new instance of  DefaultConfigurationNodeand
 initializes it with the name and a value. | 
| Modifier and Type | Method and Description | 
|---|---|
| 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  SubNodesinstance 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<ConfigurationNode> | getAttributes()Returns a list with the attributes of this node. | 
| List<ConfigurationNode> | 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<ConfigurationNode> | getChildren()Returns a list with all children of this node. | 
| List<ConfigurationNode> | 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. | 
public DefaultConfigurationNode()
DefaultConfigurationNode.public DefaultConfigurationNode(String name)
DefaultConfigurationNode and
 initializes it with the node name.name - the name of this nodepublic 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<ConfigurationNode> getChildren()
getChildren in interface ConfigurationNodepublic int getChildrenCount()
getChildrenCount in interface ConfigurationNodepublic List<ConfigurationNode> getChildren(String name)
getChildren in interface ConfigurationNodename - the name; can be null , then all children are returnedpublic int getChildrenCount(String name)
getChildrenCount in interface ConfigurationNodename - the name; can be null , then the number of all
 children is returnedpublic 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 removedpublic boolean removeChild(String childName)
removeChild in interface ConfigurationNodechildName - the name of the children to be removedpublic 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<ConfigurationNode> getAttributes()
DefaultConfigurationNode objects, too.getAttributes in interface ConfigurationNodepublic int getAttributeCount()
getAttributeCount in interface ConfigurationNodepublic List<ConfigurationNode> getAttributes(String name)
getAttributes in interface ConfigurationNodename - the attribute's namepublic int getAttributeCount(String name)
getAttributeCount in interface ConfigurationNodename - the namepublic boolean removeAttribute(ConfigurationNode node)
removeAttribute in interface ConfigurationNodenode - the attribute node to be removedpublic boolean removeAttribute(String name)
removeAttribute in interface ConfigurationNodename - the namepublic 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 nodesSubNodes object to useprotected void removeReference()
Copyright © 2001–2013 The Apache Software Foundation. All rights reserved.