public abstract class Node extends Object implements Serializable, Cloneable
| Modifier | Constructor and Description |
|---|---|
protected |
Node(Node parent)
Creates a new node with the given parent, an empty string as element name and no attributes.
|
protected |
Node(Node parent,
Map<String,String> attributes)
Creates a new node with the given parameters and an empty string as element name.
|
protected |
Node(String elementName,
Node parent,
Map<String,String> attributes)
Creates a new node with the given parameters.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addAttribute(String name,
String value) |
void |
addChild(Node child) |
void |
addChildren(List<Node> childs) |
protected void |
checkCreateConditions(Node parent,
Map<String,String> attributes)
This method will automatically be called during creation of this Node.
|
abstract Node |
clone(Node newParent)
This method returns a clone of the current node whichs parent node is specified by the parameter newParent.
|
Node |
cloneAll(Node newParent)
This method returns a clone subtree beginning with the current node whichs parent node is specified by the
parameter newParent, including all children as clones.
|
Map<String,String> |
getAttributes() |
protected boolean |
getBooleanAttribute(String attributeName)
Returns true if an xml attribute with the given name is found and contains "true" or "1".
|
protected boolean |
getBooleanAttribute(String attributeName,
boolean defaultValue)
Returns true if an xml attribute with the given name is found and contains "true" or "1".
|
protected <T> T |
getCachedObject(T object) |
protected Node |
getChild(Class type)
Returns the first found child of the given type.
|
List<Node> |
getChildren() |
<T> List<T> |
getChildren(Class<T> type)
Returns a list of children which are of the given type.
|
protected List<Node> |
getChildrenInternal(boolean create) |
EditorNode |
getEditorNode()
Returns the parent
EditorNode instance of this node, or Null, if this Node
is not a child of an EditorNode. |
String |
getElementName() |
protected int |
getIntegerAttribute(String attributeName)
/** Returns the value of an xml attribute of type int with the given name (the String from the xml file will be
parsed for an int value).
|
protected int |
getIntegerAttribute(String attributeName,
int defaultValue)
Returns the value of an xml attribute of type int with the given name (the String from the xml file will be parsed
for an int value).
|
Logger |
getLogger() |
Node |
getParent() |
int |
getPosition() |
String |
getPositionInfo() |
protected String |
getStringAttribute(String attributeName)
Returns the value of an xml attribute of type String with the given name.
|
protected String |
getStringAttribute(String attributeName,
String defaultValue)
Returns the value of an xml attribute of type String with the given name.
|
protected Node |
getSuperNode(Class type) |
protected void |
removeAttribute(String name) |
void |
removeChild(Node child) |
void |
replace(int pos) |
void |
replaceChild(Node oldChild,
Node newChild) |
protected void |
setAttributes(Map<String,String> attributes) |
void |
setElementName(String string)
Set the name of the xml element this node represents.
|
protected void |
setParent(Node newParent) |
void |
setPosition(int position) |
protected void |
setPositionInfo(String positionInfo) |
protected Node(String elementName, Node parent, Map<String,String> attributes) throws NodeCreationFailedException
elementName - the name of the xml element this node representsparent - the parent node of this nodeattributes - the map of xml attributesNodeCreationFailedExceptionprotected Node(Node parent, Map<String,String> attributes) throws NodeCreationFailedException
parent - the parent node of this nodeattributes - the map of xml attributesNodeCreationFailedExceptionprotected Node(Node parent) throws NodeCreationFailedException
parent - the parent node of this nodeNodeCreationFailedExceptionpublic void addChild(Node child)
public void removeChild(Node child)
public <T> List<T> getChildren(Class<T> type)
public Node getParent()
protected <T> T getCachedObject(T object)
protected String getStringAttribute(String attributeName, String defaultValue)
attributeName - the name of the xml attributedefaultValue - the default value if the attribute is not foundprotected String getStringAttribute(String attributeName)
attributeName - the name of the xml attributeprotected boolean getBooleanAttribute(String attributeName, boolean defaultValue)
attributeName - the name of the xml attributedefaultValue - the default value if the attribute is not foundprotected boolean getBooleanAttribute(String attributeName)
attributeName - the name of the xml attributeprotected int getIntegerAttribute(String attributeName, int defaultValue)
attributeName - the name of the xml attributedefaultValue - the default value if the attribute is not found or could not be parsedprotected int getIntegerAttribute(String attributeName)
attributeName - the name of the xml attributeprotected void removeAttribute(String name)
protected void setPositionInfo(String positionInfo)
public String getPositionInfo()
protected void checkCreateConditions(Node parent, Map<String,String> attributes) throws NodeCreationFailedException
parent - the parent node as given to the constructorattributes - the attribute map as given to the constructorNodeCreationFailedException - if the creation of the node failspublic Logger getLogger()
public String getElementName()
public void setElementName(String string)
string - the element namepublic abstract Node clone(Node newParent)
newParent - The parent of the cloned node.public Node cloneAll(Node newParent)
newParent - The parent of the cloned node.protected void setParent(Node newParent)
newParent - public EditorNode getEditorNode()
EditorNode instance of this node, or Null, if this Node
is not a child of an EditorNode.EditorNode instance of this node, or Null, if this
Node is not a child of an EditorNodepublic void replace(int pos)
public int getPosition()
public void setPosition(int position)
Copyright © 2017 SAP SE. All Rights Reserved.