Package groovy.util

# Class NodePrinter

java.lang.Object
groovy.util.NodePrinter

public class NodePrinter extends Object
A helper class for creating nested trees of data

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected final IndentPrinter`
  `out`
  Writer used for node output.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `NodePrinter()`
  Creates a printer that writes to `System.out`.
  `NodePrinter(IndentPrinter out)`
  Creates a printer backed by the supplied `IndentPrinter`.
  `NodePrinter(PrintWriter out)`
  Creates a printer backed by the supplied writer.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `print(Node node)`
  Prints the supplied node tree.
  `protected void`
  `printAttributes(Map attributes)`
  Prints node attributes.
  `protected void`
  `printList(List list)`
  Prints a node value list.
  `protected void`
  `printName(Node node)`
  Prints the node name.

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

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

- ## Field Details

  - ### out

    protected final IndentPrinter out
    Writer used for node output.

- ## Constructor Details

  - ### NodePrinter

    public NodePrinter()
    Creates a printer that writes to `System.out`.

  - ### NodePrinter

    public NodePrinter(PrintWriter out)
    Creates a printer backed by the supplied writer.
    Parameters:
      `out` - the writer to wrap

  - ### NodePrinter

    public NodePrinter(IndentPrinter out)
    Creates a printer backed by the supplied `IndentPrinter`.
    Parameters:
      `out` - the printer to use

- ## Method Details

  - ### print

    public void print(Node node)
    Prints the supplied node tree.
    Parameters:
      `node` - the node to print

  - ### printName

    protected void printName(Node node)
    Prints the node name.
    Parameters:
      `node` - the node whose name should be printed

  - ### printList

    protected void printList(List list)
    Prints a node value list.
    Parameters:
      `list` - the list to print

  - ### printAttributes

    protected void printAttributes(Map attributes)
    Prints node attributes.
    Parameters:
      `attributes` - the attributes to print