Class PropertiesCommentService

java.lang.Object
org.openrewrite.internal.CommentService
org.openrewrite.properties.service.PropertiesCommentService

@Incubating(since="8.86.0") public class PropertiesCommentService extends org.openrewrite.internal.CommentService
CommentService for the .properties LST model. Like XML, a properties comment is a real Properties.Comment sibling node within the Properties.File content rather than prefix metadata, so the service walks up to the file and edits the run of comment siblings that immediately precede the element. The multiline flag and any explicit suffix are ignored, since a properties comment is always a single # line.
  • Constructor Details

    • PropertiesCommentService

      public PropertiesCommentService()
  • 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
    • 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