pro.verron.officestamper.api.AbstractCommentProcessor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of engine Show documentation
Show all versions of engine Show documentation
Office-stamper is a Java template engine for docx documents, forked from org.wickedsource.docx-stamper
package pro.verron.officestamper.api;
import org.docx4j.wml.P;
import org.docx4j.wml.R;
import org.springframework.lang.Nullable;
import java.util.Objects;
/**
* AbstractCommentProcessor is an abstract base class for comment processors.
* It implements the CommentProcessor interface.
* It provides common functionality and fields that subclasses can use.
*/
public abstract class AbstractCommentProcessor
implements CommentProcessor {
/**
* PlaceholderReplacer used to replace expressions in the comment text.
*/
protected final ParagraphPlaceholderReplacer placeholderReplacer;
private P paragraph;
private R currentRun;
private Comment currentComment;
/**
* Creates an instance of AbstractCommentProcessor with the given ParagraphPlaceholderReplacer.
*
* @param placeholderReplacer the ParagraphPlaceholderReplacer used to replace expressions in the comment text
*/
protected AbstractCommentProcessor(ParagraphPlaceholderReplacer placeholderReplacer) {
this.placeholderReplacer = placeholderReplacer;
}
/**
* Getter for the field currentCommentWrapper
.
*
* @return a {@link Comment} object
*/
public Comment getCurrentCommentWrapper() {
return currentComment;
}
/**
* {@inheritDoc}
*/
@Override
public void setCurrentCommentWrapper(Comment currentComment) {
Objects.requireNonNull(currentComment.getCommentRangeStart());
Objects.requireNonNull(currentComment.getCommentRangeEnd());
this.currentComment = currentComment;
}
/**
* Getter for the field paragraph
.
*
* @return a {@link P} object
*/
public P getParagraph() {
return paragraph;
}
/**
* {@inheritDoc}
*/
@Override
public void setParagraph(P paragraph) {
this.paragraph = paragraph;
}
/**
* Getter for the field currentRun
.
*
* @return a {@link R} object
*/
public R getCurrentRun() {
return currentRun;
}
/**
* {@inheritDoc}
*/
@Override
public void setCurrentRun(@Nullable R run) {
this.currentRun = run;
}
}