Package org.opt4j.config
Class JNode
java.lang.Object
org.opt4j.config.JNode
Wrapper for
Node
elements. This class integrates Java 5
functionality with generics.-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionappendChild
(String name) Append a newJNode
with a given name.appendChild
(JNode jNode) Append aJNode
.appendChild
(Node node) Append an XMLNode
.getAttribute
(String attribute) Returns the value of an attribute.Returns aMap
of all attributes.getChild()
Returns the first child.Returns the first child with a specified name.Returns all children.getChildren
(String name) Returns all children with a specified name.Returns the ownerDocument
.getName()
Returns the name.getNode()
Retrieves theNode
element.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
Sets the strings content.toString()
-
Field Details
-
node
-
-
Constructor Details
-
JNode
- Parameters:
node
- the node to wrap
-
JNode
- Parameters:
document
- the XML documentname
- the specified name of the node
-
-
Method Details
-
getNode
Retrieves theNode
element.- Returns:
- the XML node
-
getName
Returns the name.- Returns:
- the name
-
getAttributes
Returns aMap
of all attributes.- Returns:
- a map of all attributes
-
getAttribute
Returns the value of an attribute.- Parameters:
attribute
- the name of the attribute- Returns:
- the value of the attribute
- See Also:
-
hasAttribute
Returnstrue
if the attribute is existent.- Parameters:
attribute
- the name of the attribute- Returns:
- the value of the attribute
-
getChild
Returns the first child.- Returns:
- the first child
-
getChild
Returns the first child with a specified name.- Parameters:
name
- the name of the child- Returns:
- the first child with the specified name
-
getChildren
Returns all children.- Returns:
- a list of all children.
-
getChildren
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
Returns the strings content.- Returns:
- the strings content
- See Also:
-
hasText
public boolean hasText()Returnstrue
if this node has a strings content.- Returns:
true
if this node has a strings content
-
setText
Sets the strings content.- Parameters:
text
- the strings content to set- See Also:
-
setAttribute
Sets an attribute to a value.- Parameters:
attribute
- the name of the attributevalue
- the value- See Also:
-
appendChild
Append a newJNode
with a given name.- Parameters:
name
- the specified name- Returns:
- the appended JNode
-
appendChild
Append an XMLNode
.- Parameters:
node
- the XML node- Returns:
- the appended JNode
-
appendChild
Append aJNode
.- Parameters:
jNode
- the node to append- Returns:
- the appended JNode
-
getDocument
Returns the ownerDocument
.- Returns:
- the owner XML document
-
toString
-