Package org.opt4j.config
Class JNode
- java.lang.Object
-
- org.opt4j.config.JNode
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JNode
appendChild(String name)
Append a newJNode
with a given name.JNode
appendChild(JNode jNode)
Append aJNode
.JNode
appendChild(Node node)
Append an XMLNode
.String
getAttribute(String attribute)
Returns the value of an attribute.Map<String,String>
getAttributes()
Returns aMap
of all attributes.JNode
getChild()
Returns the first child.JNode
getChild(String name)
Returns the first child with a specified name.List<JNode>
getChildren()
Returns all children.List<JNode>
getChildren(String name)
Returns all children with a specified name.Document
getDocument()
Returns the ownerDocument
.String
getName()
Returns the name.Node
getNode()
Retrieves theNode
element.String
getText()
Returns the strings content.boolean
hasAttribute(String attribute)
Returnstrue
if the attribute is existent.boolean
hasText()
Returnstrue
if this node has a strings content.void
setAttribute(String attribute, String value)
Sets an attribute to a value.void
setText(String text)
Sets the strings content.String
toString()
-
-
-
Field Detail
-
node
protected final Node node
-
-
Method Detail
-
getName
public String getName()
Returns the name.- Returns:
- the name
-
getAttributes
public Map<String,String> getAttributes()
Returns aMap
of all attributes.- Returns:
- a map of all attributes
-
getAttribute
public String getAttribute(String attribute)
Returns the value of an attribute.- Parameters:
attribute
- the name of the attribute- Returns:
- the value of the attribute
- See Also:
setAttribute(java.lang.String, java.lang.String)
-
hasAttribute
public boolean hasAttribute(String attribute)
Returnstrue
if the attribute is existent.- Parameters:
attribute
- the name of the attribute- Returns:
- the value of the attribute
-
getChild
public JNode getChild()
Returns the first child.- Returns:
- the first child
-
getChild
public JNode getChild(String name)
Returns the first child with a specified name.- Parameters:
name
- the name of the child- Returns:
- the first child with the specified name
-
getChildren
public List<JNode> getChildren(String name)
Returns all children with a specified name.- Parameters:
name
- the name of the children- Returns:
- a list of all children with the specified name
-
getText
public String getText()
Returns the strings content.- Returns:
- the strings content
- See Also:
setText(java.lang.String)
-
hasText
public boolean hasText()
Returnstrue
if this node has a strings content.- Returns:
true
if this node has a strings content
-
setText
public void setText(String text)
Sets the strings content.- Parameters:
text
- the strings content to set- See Also:
getText()
-
setAttribute
public void setAttribute(String attribute, String value)
Sets an attribute to a value.- Parameters:
attribute
- the name of the attributevalue
- the value- See Also:
getAttribute(java.lang.String)
-
appendChild
public JNode appendChild(String name)
Append a newJNode
with a given name.- Parameters:
name
- the specified name- Returns:
- the appended JNode
-
appendChild
public JNode appendChild(Node node)
Append an XMLNode
.- Parameters:
node
- the XML node- Returns:
- the appended JNode
-
appendChild
public JNode appendChild(JNode jNode)
Append aJNode
.- Parameters:
jNode
- the node to append- Returns:
- the appended JNode
-
getDocument
public Document getDocument()
Returns the ownerDocument
.- Returns:
- the owner XML document
-
-