Class JavaCommentService

java.lang.Object
org.openrewrite.internal.CommentService
org.openrewrite.java.service.JavaCommentService

@Incubating(since="8.86.0") public class JavaCommentService extends org.openrewrite.internal.CommentService
CommentService for the J LST model. Because Kotlin and Groovy reuse J (and J.Space) for whitespace and comments, this single implementation serves Java, Kotlin, and Groovy sources.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.openrewrite.Tree
    addComment(org.openrewrite.Cursor cursor, String text, boolean multiline, org.openrewrite.trait.Comments.Placement placement)
     
    org.openrewrite.Tree
    addComment(org.openrewrite.Cursor cursor, String text, boolean multiline, org.openrewrite.trait.Comments.Placement placement, @Nullable String suffix)
     
    getComments(org.openrewrite.Cursor cursor)
     
    org.openrewrite.Tree
    removeComment(org.openrewrite.Cursor cursor, String text)
     
    org.openrewrite.Tree
    replaceComment(org.openrewrite.Cursor cursor, String existingText, String newText)
     

    Methods inherited from class org.openrewrite.internal.CommentService

    addComment, equivalent, hasComment, hasEquivalentComment

    Methods inherited from class java.lang.Object

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

    • JavaCommentService

      public JavaCommentService()
  • Method Details

    • getComments

      public List<String> getComments(org.openrewrite.Cursor cursor)
      Specified by:
      getComments in class org.openrewrite.internal.CommentService
    • addComment

      public org.openrewrite.Tree addComment(org.openrewrite.Cursor cursor, String text, boolean multiline, org.openrewrite.trait.Comments.Placement placement)
      Specified by:
      addComment in class org.openrewrite.internal.CommentService
    • addComment

      public org.openrewrite.Tree addComment(org.openrewrite.Cursor cursor, String text, boolean multiline, org.openrewrite.trait.Comments.Placement placement, @Nullable String suffix)
      Overrides:
      addComment in class org.openrewrite.internal.CommentService
    • removeComment

      public org.openrewrite.Tree removeComment(org.openrewrite.Cursor cursor, String text)
      Specified by:
      removeComment in class org.openrewrite.internal.CommentService
    • replaceComment

      public org.openrewrite.Tree replaceComment(org.openrewrite.Cursor cursor, String existingText, String newText)
      Specified by:
      replaceComment in class org.openrewrite.internal.CommentService