|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.espirit.firstspirit.client.access.editor.Node
public final class Node
A node has a name
, attributes (Node.getAttribute(String)
,
Node.setAttribute(String, String)
), and either a textual value
or 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)
Method Summary | |
---|---|
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 . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
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.Node.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.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |