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 JNodeappendChild(String name)Append a newJNodewith a given name.JNodeappendChild(JNode jNode)Append aJNode.JNodeappendChild(Node node)Append an XMLNode.StringgetAttribute(String attribute)Returns the value of an attribute.Map<String,String>getAttributes()Returns aMapof all attributes.JNodegetChild()Returns the first child.JNodegetChild(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.DocumentgetDocument()Returns the ownerDocument.StringgetName()Returns the name.NodegetNode()Retrieves theNodeelement.StringgetText()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.voidsetText(String text)Sets the strings content.StringtoString()
-
-
-
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 aMapof 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)
Returnstrueif 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()
Returnstrueif this node has a strings content.- Returns:
trueif 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 newJNodewith 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
-
-