Package Summary Overview Summary

Module java.base
Package java.lang.classfile.componentsPREVIEW

# Interface ClassPrinter.Node

All Known Subinterfaces:
  `ClassPrinter.LeafNodePREVIEW`, `ClassPrinter.ListNodePREVIEW`, `ClassPrinter.MapNodePREVIEW`

Enclosing class:
  `ClassPrinterPREVIEW`

public static sealed interface ClassPrinter.Node permits ClassPrinter.MapNodePREVIEW, ClassPrinter.LeafNodePREVIEW, ClassPrinter.ListNodePREVIEW
`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 Summary

  Modifier and Type
  Method
  Description
  `ConstantDesc`
  `name()`
  Printable name of the node.
  `default void`
  `toJson (Consumer<String> out)`
  Prints the node and its sub-tree into JSON format.
  `default void`
  `toXml (Consumer<String> out)`
  Prints the node and its sub-tree into XML format.
  `default void`
  `toYaml (Consumer<String> out)`
  Prints the node and its sub-tree into YAML format.
  `Stream <ClassPrinter.NodePREVIEW>`
  `walk()`
  Walks through the underlying tree.

- ## Method Details

  - ### name

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

  - ### walk

    Stream<ClassPrinter.NodePREVIEW> 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