1 | package pro.verron.officestamper.api; | |
2 | ||
3 | import org.docx4j.wml.P; | |
4 | import org.docx4j.wml.R; | |
5 | import org.springframework.lang.Nullable; | |
6 | import pro.verron.officestamper.core.StandardParagraph; | |
7 | ||
8 | import java.util.Objects; | |
9 | ||
10 | /// AbstractCommentProcessor is an abstract base class for comment processors. | |
11 | /// It implements the CommentProcessor interface. | |
12 | /// It provides common functionality and fields that subclasses can use. | |
13 | public abstract class AbstractCommentProcessor | |
14 | implements CommentProcessor { | |
15 | ||
16 | /// PlaceholderReplacer used to replace expressions in the comment text. | |
17 | protected final ParagraphPlaceholderReplacer placeholderReplacer; | |
18 | private Paragraph paragraph; | |
19 | private R currentRun; | |
20 | private Comment currentComment; | |
21 | ||
22 | /// Creates an instance of AbstractCommentProcessor with the given ParagraphPlaceholderReplacer. | |
23 | /// | |
24 | /// @param placeholderReplacer the ParagraphPlaceholderReplacer used to replace expressions in the comment text | |
25 | protected AbstractCommentProcessor(ParagraphPlaceholderReplacer placeholderReplacer) { | |
26 | this.placeholderReplacer = placeholderReplacer; | |
27 | } | |
28 | ||
29 | /// Retrieves the current comment wrapper associated with the processor. | |
30 | /// | |
31 | /// @return the current [Comment] object being processed | |
32 | public Comment getCurrentCommentWrapper() { | |
33 |
1
1. getCurrentCommentWrapper : replaced return value with null for pro/verron/officestamper/api/AbstractCommentProcessor::getCurrentCommentWrapper → KILLED |
return currentComment; |
34 | } | |
35 | ||
36 | @Override public void setCurrentCommentWrapper(Comment currentComment) { | |
37 | Objects.requireNonNull(currentComment.getCommentRangeStart()); | |
38 | Objects.requireNonNull(currentComment.getCommentRangeEnd()); | |
39 | this.currentComment = currentComment; | |
40 | } | |
41 | ||
42 | @Override public void setProcessorContext(ProcessorContext processorContext) { | |
43 |
1
1. setProcessorContext : removed call to pro/verron/officestamper/api/AbstractCommentProcessor::setParagraph → KILLED |
setParagraph(processorContext.paragraph()); |
44 |
1
1. setProcessorContext : removed call to pro/verron/officestamper/api/AbstractCommentProcessor::setCurrentRun → KILLED |
setCurrentRun(processorContext.run()); |
45 |
1
1. setProcessorContext : removed call to pro/verron/officestamper/api/AbstractCommentProcessor::setCurrentCommentWrapper → KILLED |
setCurrentCommentWrapper(processorContext.comment()); |
46 | } | |
47 | ||
48 | /// Retrieves the current run being processed. | |
49 | /// | |
50 | /// @return the current [R] object being processed | |
51 | public R getCurrentRun() { | |
52 |
1
1. getCurrentRun : replaced return value with null for pro/verron/officestamper/api/AbstractCommentProcessor::getCurrentRun → KILLED |
return currentRun; |
53 | } | |
54 | ||
55 | @Override public void setCurrentRun(@Nullable R run) { | |
56 | this.currentRun = run; | |
57 | } | |
58 | ||
59 | public Paragraph getParagraph() { | |
60 |
1
1. getParagraph : replaced return value with null for pro/verron/officestamper/api/AbstractCommentProcessor::getParagraph → KILLED |
return paragraph; |
61 | } | |
62 | ||
63 | /// @param paragraph coordinates of the currently processed paragraph within the template. | |
64 | /// | |
65 | /// @deprecated use [#setParagraph(Paragraph)] instead | |
66 | @Deprecated(since = "2.6", forRemoval = true) public void setParagraph(P paragraph) { | |
67 | this.paragraph = StandardParagraph.from((DocxPart) paragraph.getParent(), paragraph); | |
68 | } | |
69 | ||
70 | /// Sets the current paragraph being processed. | |
71 | /// | |
72 | /// @param paragraph the Paragraph instance representing the currently processed paragraph | |
73 | /// in the document. | |
74 | public void setParagraph(Paragraph paragraph) { | |
75 | this.paragraph = paragraph; | |
76 | } | |
77 | } | |
Mutations | ||
33 |
1.1 |
|
43 |
1.1 |
|
44 |
1.1 |
|
45 |
1.1 |
|
52 |
1.1 |
|
60 |
1.1 |