Package groovy.util
Class NodeBuilder
java.lang.Object
groovy.lang.GroovyObjectSupport
groovy.util.BuilderSupport
groovy.util.NodeBuilder
- All Implemented Interfaces:
GroovyObject
A helper class for creating nested trees of Node objects for
handling arbitrary data
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ObjectcreateNode(Object name) Creates a node with the given name.protected ObjectcreateNode(Object name, Object value) Creates a node with the given name and value.protected ObjectcreateNode(Object name, Map attributes) Creates a node with the given name and attributes.protected ObjectcreateNode(Object name, Map attributes, Object value) Creates a node with the given name, attributes, and value.protected NodeReturns the current node being built.static NodeBuilderCreates a newNodeBuilder.protected voidLinks a newly created child node to its parent.Methods inherited from class groovy.util.BuilderSupport
doInvokeMethod, getCurrent, getName, invokeMethod, invokeMethod, nodeCompleted, postNodeCompletion, setClosureDelegate, setCurrentMethods inherited from class groovy.lang.GroovyObjectSupport
getMetaClass, setMetaClassMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface groovy.lang.GroovyObject
getProperty, setProperty
-
Constructor Details
-
NodeBuilder
public NodeBuilder()
-
-
Method Details
-
newInstance
Creates a newNodeBuilder.- Returns:
- a new builder instance
-
setParent
Links a newly created child node to its parent.- Specified by:
setParentin classBuilderSupport- Parameters:
parent- the parent nodechild- the child node
-
createNode
Creates a node with the given name.- Specified by:
createNodein classBuilderSupport- Parameters:
name- the node name- Returns:
- the created node
-
createNode
Creates a node with the given name and value.- Specified by:
createNodein classBuilderSupport- Parameters:
name- the node namevalue- the node value- Returns:
- the created node
-
createNode
Creates a node with the given name and attributes.- Specified by:
createNodein classBuilderSupport- Parameters:
name- the node nameattributes- the node attributes- Returns:
- the created node
-
createNode
Creates a node with the given name, attributes, and value.- Specified by:
createNodein classBuilderSupport- Parameters:
name- the node nameattributes- the node attributesvalue- the node value- Returns:
- the created node
-
getCurrentNode
Returns the current node being built.- Returns:
- the current node, or
nullif none is active
-