groovy.util
Class Node
java.lang.Object
|
+--groovy.util.Node
- public class Node
- extends Object
Represents an arbitrary tree node which can be used for structured metadata which can be any arbitrary XML-like tree.
A node can have a name, a value and an optional Map of attributes.
Typically the name is a String and a value is either a String or a List of other Nodes.
Though the types are extensible to provide a flexible structure.
e.g. you could use a QName as the name which includes a namespace URI and a local name. Or a JMX ObjectName etc.
So this class can represent metadata like {foo a=1 b="abc"} or nested metadata like {foo a=1 b="123" { bar x=12 text="hello" }}
- Version:
- $Revision: 1.5 $
- Author:
- James Strachan
Node
public Node(groovy.util.Node parent,
Object name)
Node
public Node(groovy.util.Node parent,
Object name,
Object value)
Node
public Node(groovy.util.Node parent,
Object name,
Map attributes)
Node
public Node(groovy.util.Node parent,
Object name,
Map attributes,
Object value)
text
public String text()
children
public List children()
attributes
public Map attributes()
attribute
public Object attribute(Object key)
name
public Object name()
value
public Object value()
setValue
public void setValue(Object value)
parent
public groovy.util.Node parent()
get
public Object get(String key)
depthFirst
public List depthFirst()
- Provide a collection of all the nodes in the tree
using a depth first traversal
bredthFirst
public List bredthFirst()
- Provide a collection of all the nodes in the tree
using a bredth first traversal
toString
public String toString()
- Overrides:
toString
in class Object
print
public void print(PrintWriter out)
Copyright © 2003 The Codehaus. All Rights Reserved.