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