Interface ClassPrinter.Node

All Known Subinterfaces:
ClassPrinter.LeafNodePREVIEW, ClassPrinter.ListNodePREVIEW, ClassPrinter.MapNodePREVIEW
Enclosing class:
ClassPrinterPREVIEW

public static sealed interface ClassPrinter.Node permits ClassPrinter.LeafNodePREVIEW, ClassPrinter.ListNodePREVIEW, ClassPrinter.MapNodePREVIEW
Node is a preview API of the Java platform.
Programs can only use Node when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
Named, traversable, and printable node parent.
Since:
22
  • Method Details

    • name

      ConstantDesc name()
      Printable name of the node.
      Returns:
      name of the node
    • walk

      Walks through the underlying tree.
      Returns:
      ordered stream of nodes
    • toJson

      default void toJson(Consumer<String> out)
      Prints the node and its sub-tree into JSON format.
      Parameters:
      out - consumer of the printed fragments
    • toXml

      default void toXml(Consumer<String> out)
      Prints the node and its sub-tree into XML format.
      Parameters:
      out - consumer of the printed fragments
    • toYaml

      default void toYaml(Consumer<String> out)
      Prints the node and its sub-tree into YAML format.
      Parameters:
      out - consumer of the printed fragments