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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionappendChild(String name) Append a newJNodewith a given name.appendChild(JNode jNode) Append aJNode.appendChild(Node node) Append an XMLNode.getAttribute(String attribute) Returns the value of an attribute.Returns aMapof 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 theNodeelement.getText()Returns the strings content.booleanhasAttribute(String attribute) Returnstrueif the attribute is existent.booleanhasText()Returnstrueif this node has a strings content.voidsetAttribute(String attribute, String value) Sets an attribute to a value.voidSets 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 theNodeelement.- Returns:
- the XML node
-
getName
Returns the name.- Returns:
- the name
-
getAttributes
Returns aMapof 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
Returnstrueif 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()Returnstrueif this node has a strings content.- Returns:
trueif 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 newJNodewith 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
-