Save This Page
Home » groovy-src-1.6.3 » groovy » util » [javadoc | source]
groovy.util
public class: Node [javadoc | source]
java.lang.Object
   groovy.util.Node

All Implemented Interfaces:
    Serializable

Represents an arbitrary tree node which can be used for structured metadata or 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" }}
Constructor:
 public Node(Node parent,
    Object name) 
 public Node(Node parent,
    Object name,
    Object value) 
 public Node(Node parent,
    Object name,
    Map attributes) 
 public Node(Node parent,
    Object name,
    Map attributes,
    Object value) 
Method from groovy.util.Node Summary:
append,   appendNode,   appendNode,   appendNode,   appendNode,   attribute,   attributes,   breadthFirst,   children,   depthFirst,   get,   getAt,   iterator,   name,   parent,   print,   remove,   setMetaClass,   setValue,   text,   toString,   value
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from groovy.util.Node Detail:
 public boolean append(Node child) 
 public Node appendNode(Object name) 
 public Node appendNode(Object name,
    Map attributes) 
 public Node appendNode(Object name,
    Object value) 
 public Node appendNode(Object name,
    Map attributes,
    Object value) 
 public Object attribute(Object key) 
 public Map attributes() 
 public List breadthFirst() 
    Provide a collection of all the nodes in the tree using a breadth-first traversal.
 public List children() 
 public List depthFirst() 
    Provide a collection of all the nodes in the tree using a depth first traversal.
 public Object get(String key) 
    Provides lookup of elements by non-namespaced name
 public NodeList getAt(QName name) 
    Provides lookup of elements by QName.
 public Iterator iterator() 
 public Object name() 
 public Node parent() 
 public  void print(PrintWriter out) 
 public boolean remove(Node child) 
 protected static  void setMetaClass(MetaClass metaClass,
    Class nodeClass) 
 public  void setValue(Object value) 
 public String text() 
 public String toString() 
 public Object value()