Package: groovy.util

## [Java] Class NodePrinter

- groovy.util.NodePrinter

-     public class NodePrinter
      extends Object

  A helper class for creating nested trees of data

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `protected IndentPrinter` | `out` | Writer used for node output.

  - ### Constructor Summary

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

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public 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.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### protected final IndentPrinter out

      Writer used for node output.

  - ### Constructor Detail

    - #### public NodePrinter()

      Creates a printer that writes to `System.out`.

    - #### public NodePrinter(PrintWriter out)

      Creates a printer backed by the supplied writer.

      Parameters:
        `out` - the writer to wrap

    - #### public NodePrinter(IndentPrinter out)

      Creates a printer backed by the supplied IndentPrinter.

      Parameters:
        `out` - the printer to use

  - ### Method Detail

    - #### public void print(Node node)

      Prints the supplied node tree.

      Parameters:
        `node` - the node to print

    - #### protected void printAttributes(Map attributes)

      Prints node attributes.

      Parameters:
        `attributes` - the attributes to print

    - #### protected void printList(List list)

      Prints a node value list.

      Parameters:
        `list` - the list to print

    - #### protected void printName(Node node)

      Prints the node name.

      Parameters:
        `node` - the node whose name should be printed