- All Known Implementing Classes:
AbstractCommentProcessor
public interface CommentProcessor
Represents a comment processor for handling context-specific processing and operations
on comments, paragraphs, and runs within a document.
This interface serves as a contract
for implementing custom comment processors.
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
commitChanges
(org.docx4j.openpackaging.packages.WordprocessingMLPackage document) Deprecated, for removal: This API element is subject to removal in a future version.since 2.3; for removal in future versions.default void
commitChanges
(DocxPart docxPart) Finalizes the processing of aDocxPart
document and commits any changes made to it.Retrieves the current paragraph being processed.void
reset()
Resets the internal state of the comment processor to its initial state.void
setCurrentCommentWrapper
(Comment comment) Sets the current comment being processed in the comment processor.void
setCurrentRun
(org.docx4j.wml.R run) Sets the currently processed run in the comment processor.void
setParagraph
(org.docx4j.wml.P paragraph) Deprecated, for removal: This API element is subject to removal in a future version.void
setProcessorContext
(ProcessorContext processorContext) Sets the processing context for the comment processor.
-
Method Details
-
setProcessorContext
Sets the processing context for the comment processor. This method serves to pass relevant contextual information, such as the current paragraph, run, comment, and placeholder being processed. It's always invoked before any custom methods of the customCommentProcessor
interface.- Parameters:
processorContext
- the context in which the processor operates, containing details about the paragraph, run, comment, and placeholder being processed.
-
setCurrentRun
void setCurrentRun(@Nullable org.docx4j.wml.R run) Sets the currently processed run in the comment processor. This method should be called to specify the current run within the context of processing a document.- Parameters:
run
- the run object that is currently being processed, or null if there is no specific run to set
-
commitChanges
Finalizes the processing of aDocxPart
document and commits any changes made to it. This method is used to ensure that all modifications performed during the processing of comments or other operations in the DocxPart are applied to the underlying document.- Parameters:
docxPart
- theDocxPart
instance representing a part of the document that is being processed; contains the underlying WordprocessingMLPackage document to which the changes are committed
-
commitChanges
@Deprecated(since="2.3", forRemoval=true) default void commitChanges(org.docx4j.openpackaging.packages.WordprocessingMLPackage document) Deprecated, for removal: This API element is subject to removal in a future version.since 2.3; for removal in future versions. Use updated methods or processes instead.Commits changes to the provided WordprocessingMLPackage document. This method is deprecated and should not be used in new implementations. It is retained only for compatibility with legacy implementations.- Parameters:
document
- the WordprocessingMLPackage document to which changes were made- Throws:
OfficeStamperException
- always thrown, as this method should no longer be called
-
getParagraph
Paragraph getParagraph()Retrieves the current paragraph being processed.- Returns:
- the current
Paragraph
object associated with the comment processor
-
setParagraph
Deprecated, for removal: This API element is subject to removal in a future version.Sets the current paragraph being processed in the comment processor. This method is deprecated and scheduled for removal in a future version.- Parameters:
paragraph
- the paragraph to set as the current paragraph being processed
-
setCurrentCommentWrapper
Sets the current comment being processed in the comment processor. This method is typically invoked to specify the comment object associated with the current processing context.- Parameters:
comment
- the comment object that is currently being processed
-
reset
void reset()Resets the internal state of the comment processor to its initial state. This method is intended to clear any stored context or settings, allowing the processor to be reused for a new processing task.
-