Class ElementNode

java.lang.Object
net.kyori.adventure.text.minimessage.internal.parser.node.ElementNode
All Implemented Interfaces:
Node
Direct Known Subclasses:
RootNode, TagNode, ValueNode

public sealed class ElementNode extends Object implements Node permits RootNode, TagNode, ValueNode
Represents a node in the tree.
Since:
4.10.0
  • Method Details

    • parent

      public @Nullable ElementNode parent()
      Returns the parent of this node, if present.
      Specified by:
      parent in interface Node
      Returns:
      the parent or null
      Since:
      4.10.0
    • token

      public @Nullable Token token()
      Returns the token that lead to the creation of this token.
      Returns:
      the token
      Since:
      4.10.0
    • sourceMessage

      public String sourceMessage()
      Returns the source message of this node.
      Returns:
      the source message
      Since:
      4.10.0
    • children

      public List<ElementNode> children()
      Returns the children of this node.
      Specified by:
      children in interface Node
      Returns:
      the children of this node
      Since:
      4.10.0
    • unsafeChildren

      public List<ElementNode> unsafeChildren()
      Returns an unsafe view of the children of this node.
      Returns:
      the children of this node
      Since:
      4.10.0
    • addChild

      public void addChild(ElementNode childNode)
      Adds a child to this node.

      This method will attempt to join text tokens together if possible.

      Parameters:
      childNode - the child node to add.
      Since:
      4.10.0
    • buildToString

      public StringBuilder buildToString(StringBuilder sb, int indent)
      Serializes this node to a string.
      Parameters:
      sb - the string builder to serialize into
      indent - the current indent level
      Returns:
      the passed string builder, for chaining
      Since:
      4.10.0
    • toString

      public String toString()
      Description copied from interface: Node
      Get a human-readable representation of this node and its descendants for debugging purposes.
      Specified by:
      toString in interface Node
      Overrides:
      toString in class Object
      Returns:
      the human-readable representation of this node tree