CommentProcessor.java

1
package pro.verron.officestamper.api;
2
3
import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
4
import org.docx4j.wml.P;
5
import org.docx4j.wml.R;
6
import org.springframework.lang.Nullable;
7
8
/// Represents a comment processor for handling context-specific processing and operations
9
/// on comments, paragraphs, and runs within a document.
10
/// This interface serves as a contract
11
/// for implementing custom comment processors.
12
public interface CommentProcessor {
13
14
    /// Sets the processing context for the comment processor.
15
    /// This method serves to pass relevant contextual information, such as the
16
    /// current paragraph, run, comment, and placeholder being processed.
17
    /// It's always invoked before any custom methods of the custom
18
    /// [CommentProcessor] interface.
19
    ///
20
    /// @param processorContext the context in which the processor operates,
21
    ///                         containing details about the paragraph, run,
22
    ///                         comment, and placeholder being processed.
23
    void setProcessorContext(ProcessorContext processorContext);
24
25
    /// Sets the currently processed run in the comment processor.
26
    /// This method should be called to specify the current run
27
    /// within the context of processing a document.
28
    ///
29
    /// @param run the run object that is currently being processed,
30
    ///            or null if there is no specific run to set
31
    void setCurrentRun(@Nullable R run);
32
33
    /// Finalizes the processing of a [DocxPart] document and commits any changes made to it.
34
    /// This method is used to ensure that all modifications performed during the processing
35
    /// of comments or other operations in the DocxPart are applied to the underlying document.
36
    ///
37
    /// @param docxPart the [DocxPart] instance representing a part of the document
38
    ///                 that is being processed; contains the underlying WordprocessingMLPackage
39
    ///                 document to which the changes are committed
40
    default void commitChanges(DocxPart docxPart) {
41 1 1. commitChanges : removed call to pro/verron/officestamper/api/CommentProcessor::commitChanges → NO_COVERAGE
        commitChanges(docxPart.document());
42
    }
43
44
    /// Commits changes to the provided WordprocessingMLPackage document.
45
    /// This method is deprecated and should not be used in new implementations.
46
    /// It is retained only for compatibility with legacy implementations.
47
    ///
48
    /// @param document the WordprocessingMLPackage document to which changes were made
49
    /// @throws OfficeStamperException always thrown, as this method should no longer be called
50
    /// @deprecated since 2.3; for removal in future versions. Use updated methods or processes instead.
51
    @Deprecated(since = "2.3", forRemoval = true) default void commitChanges(WordprocessingMLPackage document) {
52
        throw new OfficeStamperException("Should not be called since deprecation, only legacy implementations have a "
53
                                         + "reason to keep implementing this");
54
    }
55
56
    /// Retrieves the current paragraph being processed.
57
    ///
58
    /// @return the current `Paragraph` object associated with the comment processor
59
    Paragraph getParagraph();
60
61
    /// Sets the current paragraph being processed in the comment processor.
62
    /// @deprecated This method is deprecated and scheduled for removal in a future version.
63
    ///
64
    /// @param paragraph the paragraph to set as the current paragraph being processed
65
    @Deprecated(since = "2.6", forRemoval = true)
66
    void setParagraph(P paragraph);
67
68
    /// Sets the current comment being processed in the comment processor.
69
    /// This method is typically invoked to specify the comment object
70
    /// associated with the current processing context.
71
    ///
72
    /// @param comment the comment object that is currently being processed
73
    void setCurrentCommentWrapper(Comment comment);
74
75
    /// Resets the internal state of the comment processor to its initial state.
76
    /// This method is intended to clear any stored context or settings,
77
    /// allowing the processor to be reused for a new processing task.
78
    void reset();
79
}

Mutations

41

1.1
Location : commitChanges
Killed by : none
removed call to pro/verron/officestamper/api/CommentProcessor::commitChanges → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.21.0