public final class Node extends Object
name, attributes (getAttribute(String),setAttribute(String,String)), and either a textual value or #getChildren()children.
The name of a node or an attribute must be a valid name
according to this specification:
Use one of these factory methods to create an instance:
ValueEngineer.write(Object),
ValueEngineer.read(List)| Modifier and Type | Method and Description |
|---|---|
static Node |
create(String name)
Create a node with the specified name.
|
static Node |
create(String name,
Node... children)
Create a node with the specified name and the specified child nodes.
|
static Node |
create(String name,
Node child)
Create a node with the specified name and the one specified child node.
|
static Node |
create(String name,
String text)
Create a node with the specified name and the specified text content.
|
String |
getAttribute(String name)
The value of the attribute with the specified name.
|
List<Node> |
getChildren()
The list of child nodes.
|
String |
getName()
The name of the node.
|
String |
getText()
The text content of this node.
|
Node |
setAttribute(String name,
String value)
Sets the named attribute to a provided value, which might also be
null. |
public static Node create(@NotNull String name)
specification.name - A valid name.public static Node create(@NotNull String name, String text)
specification.name - A valid name.text - A textual value (may be null or empty).textual value.public static Node create(@NotNull String name, @NotNull Node child)
specification.name - A valid name (see class comment).child - The child node.public static Node create(@NotNull String name, @NotNull Node... children)
specification.name - A valid name (see class comment).children - The child nodes.@NotNull public String getName()
specification.@Nullable public String getText()
children.null it the node has no text content.@Nullable public String getAttribute(String name)
null.name - The name of the attribute.null, if no such attribute is set.setAttribute(String,String)public Node setAttribute(@NotNull String name, @Nullable String value)
null.
If the node is immutable this method throws an UnsupportedOperationException. If the node is created
with one of the static create methods the node is mutable.name - Name of the attribute to set - must be a valid attribute name according to the specification.value - The value of the attribute or null to clear the value of the specified attribute.UnsupportedOperationException - for immutable nodes.@NotNull public List<Node> getChildren()
text content is set.Copyright © 2014 e-Spirit AG. All Rights Reserved. Build 5.0_BETA.500