Package groovy.util

Class 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 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