Class JavaCommentsHelper

java.lang.Object
com.google.googlejavaformat.java.JavaCommentsHelper
All Implemented Interfaces:
CommentsHelper

public final class JavaCommentsHelper extends Object implements CommentsHelper
JavaCommentsHelper extends CommentsHelper to rewrite Java comments.
  • Field Details

    • lineSeparator

      private final String lineSeparator
    • options

      private final JavaFormatterOptions options
    • LINE_COMMENT_MISSING_SPACE_PREFIX

      private static final Pattern LINE_COMMENT_MISSING_SPACE_PREFIX
  • Constructor Details

  • Method Details

    • rewrite

      public String rewrite(Input.Tok tok, int maxWidth, int column0)
      Description copied from interface: CommentsHelper
      Try to rewrite comments, returning rewritten text.
      Specified by:
      rewrite in interface CommentsHelper
      Parameters:
      tok - the comment's tok
      maxWidth - the line length for the output
      column0 - the current column
      Returns:
      the rewritten comment
    • preserveIndentation

      private String preserveIndentation(List<String> lines, int column0)
    • indentLineComments

      private String indentLineComments(List<String> lines, int column0)
    • wrapLineComments

      private List<String> wrapLineComments(List<String> lines, int column0)
    • indentJavadoc

      private String indentJavadoc(List<String> lines, int column0)
    • javadocShaped

      private static boolean javadocShaped(List<String> lines)