public class DOM4JSettingsNode extends Object implements SettingsNode
| Modifier and Type | Field and Description |
|---|---|
static String |
NAME_ATTRIBUTE |
static String |
TAG_NAME |
static String |
VALUE_ATTRIBUTE |
| Constructor and Description |
|---|
DOM4JSettingsNode(org.dom4j.Element element) |
| Modifier and Type | Method and Description |
|---|---|
SettingsNode |
addChild(String name)
Call this to add a child node to this node.
|
SettingsNode |
addChildIfNotPresent(String name)
This adds a child node with the specified name or returns the existing child node if one already exists with said name.
|
boolean |
equals(Object obj) |
SettingsNode |
getChildNode(String name)
Returns the child node with the specified name.
|
List<SettingsNode> |
getChildNodes() |
List<SettingsNode> |
getChildNodes(String name) |
org.dom4j.Element |
getElement() |
String |
getName() |
SettingsNode |
getNodeAtPath(String... pathPortions)
Returns a node at the specified path starting at 'this' node.
|
String |
getValue() |
String |
getValueOfChild(String name,
String defaultValue)
Gets the value of the child node.
|
boolean |
getValueOfChildAsBoolean(String name,
boolean defaultValue) |
int |
getValueOfChildAsInt(String name,
int defaultValue)
Gets the value of the child node as an integer.
|
long |
getValueOfChildAsLong(String name,
long defaultValue) |
int |
hashCode() |
void |
removeAllChildren()
Deletes all the children of this node.
|
void |
removeFromParent()
Removes this node from its parent.
|
void |
setName(String name)
Sets the name of this node.
|
void |
setValue(String value)
Sets the value of this node.
|
void |
setValueOfChild(String name,
String value)
Sets the value of the child node, adding it if it is not already present.
|
void |
setValueOfChildAsBoolean(String name,
boolean value) |
void |
setValueOfChildAsInt(String name,
int value)
Sets the value of the child node as an integer, adding it if it is not already present.
|
void |
setValueOfChildAsLong(String name,
long value) |
String |
toString() |
public static final String TAG_NAME
public static final String NAME_ATTRIBUTE
public static final String VALUE_ATTRIBUTE
public org.dom4j.Element getElement()
public void setName(String name)
SettingsNodesetName in interface SettingsNodename - the new name. Cannot be null!public String getName()
getName in interface SettingsNodepublic void setValue(String value)
SettingsNodesetValue in interface SettingsNodevalue - the new value. Can be null.public String getValue()
getValue in interface SettingsNodepublic void setValueOfChild(String name, String value)
SettingsNodesetValueOfChild in interface SettingsNodename - the name of the child node.value - the new value.public String getValueOfChild(String name, String defaultValue)
SettingsNodegetValueOfChild in interface SettingsNodename - the name of the child node.defaultValue - the value to return if the child node is not presentpublic SettingsNode getChildNode(String name)
SettingsNodegetChildNode in interface SettingsNodename - the name of the sought nodepublic List<SettingsNode> getChildNodes()
getChildNodes in interface SettingsNodepublic List<SettingsNode> getChildNodes(String name)
getChildNodes in interface SettingsNodename - the names of the sought child nodes.public int getValueOfChildAsInt(String name, int defaultValue)
SettingsNodegetValueOfChildAsInt in interface SettingsNodename - the name of the child node.defaultValue - the value to return if the child node is not present or cannot be interpretted as an integer.public void setValueOfChildAsInt(String name, int value)
SettingsNodesetValueOfChildAsInt in interface SettingsNodename - the name of the child node.value - the new value.public long getValueOfChildAsLong(String name, long defaultValue)
getValueOfChildAsLong in interface SettingsNodepublic void setValueOfChildAsLong(String name, long value)
setValueOfChildAsLong in interface SettingsNodepublic boolean getValueOfChildAsBoolean(String name, boolean defaultValue)
getValueOfChildAsBoolean in interface SettingsNodepublic void setValueOfChildAsBoolean(String name, boolean value)
setValueOfChildAsBoolean in interface SettingsNodepublic SettingsNode addChild(String name)
SettingsNodeaddChild in interface SettingsNodename - the name of the nodepublic SettingsNode addChildIfNotPresent(String name)
SettingsNodeaddChildIfNotPresent in interface SettingsNodename - the name.public SettingsNode getNodeAtPath(String... pathPortions)
SettingsNodegetNodeAtPath in interface SettingsNodepathPortions - an array of 'names' of the nodes. The first item corresponds to a direct child of this node. The second item would be the grand child of this node. etc. etc.public void removeFromParent()
SettingsNoderemoveFromParent in interface SettingsNodepublic void removeAllChildren()
SettingsNoderemoveAllChildren in interface SettingsNodeCopyright © 2013. All rights reserved