Class JavadocCommentsAstVisitor.TextAccumulator

java.lang.Object
com.puppycrawl.tools.checkstyle.JavadocCommentsAstVisitor.TextAccumulator
Enclosing class:
JavadocCommentsAstVisitor

A small utility to accumulate consecutive TEXT tokens into one node, preserving the starting token for accurate location metadata.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final StringBuilder
    Buffer to accumulate TEXT token texts.
    private org.antlr.v4.runtime.Token
    The first token in the accumulation, used for line/column info.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    append(org.antlr.v4.runtime.Token token)
    Appends a TEXT token's text to the buffer and tracks the first token.
    void
    Flushes the accumulated buffer into a single JavadocNodeImpl node and adds it to the given parent.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • buffer

      private final StringBuilder buffer
      Buffer to accumulate TEXT token texts.
    • startToken

      private org.antlr.v4.runtime.Token startToken
      The first token in the accumulation, used for line/column info.
  • Constructor Details

  • Method Details

    • append

      public void append(org.antlr.v4.runtime.Token token)
      Appends a TEXT token's text to the buffer and tracks the first token.
      Parameters:
      token - the token to accumulate
    • flushTo

      public void flushTo(JavadocNodeImpl parent)
      Flushes the accumulated buffer into a single JavadocNodeImpl node and adds it to the given parent. Clears the buffer after flushing.
      Parameters:
      parent - the parent node to add the new node to