Class StandardComment

java.lang.Object
pro.verron.officestamper.core.StandardComment
All Implemented Interfaces:
Comment

public class StandardComment extends Object implements Comment
Standard implementation of the Comment interface. Represents a comment in a DOCX document with its associated range markers and content.
Since:
1.0.2
Version:
${version}
Author:
Joseph Verron, Tom Hombergs
  • Constructor Summary

    Constructors
    Constructor
    Description
    StandardComment(DocxPart part, org.docx4j.wml.CTSmartTagRun startTagRun, org.docx4j.wml.CommentRangeStart commentRangeStart, org.docx4j.wml.CommentRangeEnd commentRangeEnd, org.docx4j.wml.Comments.Comment comment, @Nullable org.docx4j.wml.R.CommentReference commentReference)
    Constructs a new StandardComment object.
  • Method Summary

    Modifier and Type
    Method
    Description
    create(DocxPart document, org.docx4j.wml.ContentAccessor parent, String expression, BigInteger id)
    Creates a new instance of StandardComment and initializes it with the given parameters, including a comment, comment range start, comment range end, and a comment reference.
    Retrieves the expression associated with the implementing entity.
    org.docx4j.wml.Comments.Comment
    Retrieves the comment associated with this object.
    org.docx4j.wml.CommentRangeEnd
    Retrieves the CommentRangeEnd object associated with this comment.
    org.docx4j.wml.CommentRangeStart
    Retrieves the CommentRangeStart object associated with this comment.
    @Nullable org.docx4j.wml.R.CommentReference
    Retrieves the R.CommentReference object associated with this comment.
    Retrieves the elements in the document that are between the comment range anchors.
    Retrieves the ID of this comment.
    Retrieves the paragraph associated with this comment.
    org.docx4j.wml.ContentAccessor
    Retrieves the parent of the comment.
    org.docx4j.wml.CTSmartTagRun
    Retrieves the CTSmartTagRun object associated with the start of this comment.
    Generates a string representation of the StandardComment object, including its ID, content, and the amount children comment.

    Methods inherited from class Object

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

    • StandardComment

      public StandardComment(DocxPart part, org.docx4j.wml.CTSmartTagRun startTagRun, org.docx4j.wml.CommentRangeStart commentRangeStart, org.docx4j.wml.CommentRangeEnd commentRangeEnd, org.docx4j.wml.Comments.Comment comment, @Nullable org.docx4j.wml.R.CommentReference commentReference)
      Constructs a new StandardComment object.
      Parameters:
      part - the DocxPart representing the document section this comment belongs to.
      startTagRun - the start tag run.
      commentRangeStart - the comment range start.
      commentRangeEnd - the comment range end.
      comment - the comment.
      commentReference - the comment reference.
  • Method Details

    • create

      public static StandardComment create(DocxPart document, org.docx4j.wml.ContentAccessor parent, String expression, BigInteger id)
      Creates a new instance of StandardComment and initializes it with the given parameters, including a comment, comment range start, comment range end, and a comment reference.
      Parameters:
      document - the DocxPart representing the document to which this comment belongs
      parent - the ContentAccessor representing the parent content of the comment range
      expression - the String content to be included in the comment
      id - the unique BigInteger identifier for the comment
      Returns:
      a StandardComment instance initialized with the specified parameters
    • toString

      public String toString()
      Generates a string representation of the StandardComment object, including its ID, content, and the amount children comment.
      Overrides:
      toString in class Object
      Returns:
      a formatted string describing the StandardComment's properties, including its ID, content, and the size of its children.
    • getParagraph

      public Paragraph getParagraph()
      Description copied from interface: Comment
      Retrieves the paragraph associated with this comment.
      Specified by:
      getParagraph in interface Comment
      Returns:
      the Paragraph object associated with this comment
    • getStartTagRun

      public org.docx4j.wml.CTSmartTagRun getStartTagRun()
      Description copied from interface: Comment
      Retrieves the CTSmartTagRun object associated with the start of this comment.
      Specified by:
      getStartTagRun in interface Comment
      Returns:
      the CTSmartTagRun object representing the start tag run of the comment
    • getCommentRangeStart

      public org.docx4j.wml.CommentRangeStart getCommentRangeStart()
      Description copied from interface: Comment
      Retrieves the CommentRangeStart object associated with this comment.
      Specified by:
      getCommentRangeStart in interface Comment
      Returns:
      the CommentRangeStart object associated with this comment
    • getParent

      public org.docx4j.wml.ContentAccessor getParent()
      Description copied from interface: Comment
      Retrieves the parent of the comment.
      Specified by:
      getParent in interface Comment
      Returns:
      the parent of the comment
    • getElements

      public List<Object> getElements()
      Description copied from interface: Comment
      Retrieves the elements in the document that are between the comment range anchors.
      Specified by:
      getElements in interface Comment
      Returns:
      a list of objects representing the elements between the comment range anchors.
    • getCommentRangeEnd

      public org.docx4j.wml.CommentRangeEnd getCommentRangeEnd()
      Description copied from interface: Comment
      Retrieves the CommentRangeEnd object associated with this comment.
      Specified by:
      getCommentRangeEnd in interface Comment
      Returns:
      the CommentRangeEnd object associated with this comment
    • getCommentReference

      public @Nullable org.docx4j.wml.R.CommentReference getCommentReference()
      Description copied from interface: Comment
      Retrieves the R.CommentReference object associated with this comment.
      Specified by:
      getCommentReference in interface Comment
      Returns:
      the R.CommentReference object associated with this comment
    • getComment

      public org.docx4j.wml.Comments.Comment getComment()
      Description copied from interface: Comment
      Retrieves the comment associated with this object.
      Specified by:
      getComment in interface Comment
      Returns:
      the comment associated with this object
    • expression

      public String expression()
      Description copied from interface: Comment
      Retrieves the expression associated with the implementing entity.
      Specified by:
      expression in interface Comment
      Returns:
      a string representing the expression
    • getId

      public BigInteger getId()
      Description copied from interface: Comment
      Retrieves the ID of this comment.
      Specified by:
      getId in interface Comment
      Returns:
      the ID.