Package groovy.util

# Class NodeBuilder

java.lang.Object
groovy.lang.GroovyObjectSupport
groovy.util.BuilderSupport
groovy.util.NodeBuilder

All Implemented Interfaces:
  `GroovyObject`

public class NodeBuilder extends BuilderSupport
A helper class for creating nested trees of Node objects for handling arbitrary data

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `NodeBuilder()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected Object`
  `createNode(Object name)`
  Creates a node with the given name.
  `protected Object`
  `createNode(Object name, Object value)`
  Creates a node with the given name and value.
  `protected Object`
  `createNode(Object name, Map attributes)`
  Creates a node with the given name and attributes.
  `protected Object`
  `createNode(Object name, Map attributes, Object value)`
  Creates a node with the given name, attributes, and value.
  `protected Node`
  `getCurrentNode()`
  Returns the current node being built.
  `static NodeBuilder`
  `newInstance()`
  Creates a new `NodeBuilder`.
  `protected void`
  `setParent(Object parent, Object child)`
  Links a newly created child node to its parent.

  ### Methods inherited from class groovy.util.BuilderSupport

  `doInvokeMethod, getCurrent, getName, invokeMethod, invokeMethod, nodeCompleted, postNodeCompletion, setClosureDelegate, setCurrent`

  ### Methods inherited from class groovy.lang.GroovyObjectSupport

  `getMetaClass, setMetaClass`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface groovy.lang.GroovyObject

  `getProperty, setProperty`

- ## Constructor Details

  - ### NodeBuilder

    public NodeBuilder()

- ## Method Details

  - ### newInstance

    public static NodeBuilder newInstance()
    Creates a new `NodeBuilder`.
    Returns:
      a new builder instance

  - ### setParent

    protected void setParent(Object parent, Object child)
    Links a newly created child node to its parent.
    Specified by:
      `setParent` in class `BuilderSupport`
    Parameters:
      `parent` - the parent node
      `child` - the child node

  - ### createNode

    protected Object createNode(Object name)
    Creates a node with the given name.
    Specified by:
      `createNode` in class `BuilderSupport`
    Parameters:
      `name` - the node name
    Returns:
      the created node

  - ### createNode

    protected Object createNode(Object name, Object value)
    Creates a node with the given name and value.
    Specified by:
      `createNode` in class `BuilderSupport`
    Parameters:
      `name` - the node name
      `value` - the node value
    Returns:
      the created node

  - ### createNode

    protected Object createNode(Object name, Map attributes)
    Creates a node with the given name and attributes.
    Specified by:
      `createNode` in class `BuilderSupport`
    Parameters:
      `name` - the node name
      `attributes` - the node attributes
    Returns:
      the created node

  - ### createNode

    protected Object createNode(Object name, Map attributes, Object value)
    Creates a node with the given name, attributes, and value.
    Specified by:
      `createNode` in class `BuilderSupport`
    Parameters:
      `name` - the node name
      `attributes` - the node attributes
      `value` - the node value
    Returns:
      the created node

  - ### getCurrentNode

    protected Node getCurrentNode()
    Returns the current node being built.
    Returns:
      the current node, or `null` if none is active