Class PlaceholderHooker.ParagraphCollector

java.lang.Object
org.docx4j.utils.TraversalUtilVisitor<org.docx4j.wml.P>
pro.verron.officestamper.api.PlaceholderHooker.ParagraphCollector
Enclosing class:
PlaceholderHooker

public static class PlaceholderHooker.ParagraphCollector extends org.docx4j.utils.TraversalUtilVisitor<org.docx4j.wml.P>

A TraversalUtilVisitor implementation that collects paragraphs matching a given pattern.

This class is used to traverse a document and collect all paragraph elements (P) that match a specified regular expression pattern. The collected paragraphs can be retrieved using the paragraphs() method.

  • Constructor Details

    • ParagraphCollector

      public ParagraphCollector(Pattern pattern)
      Constructs a new PlaceholderHooker.ParagraphCollector with the specified pattern.
      Parameters:
      pattern - the regular expression pattern to match against paragraphs
  • Method Details

    • apply

      public void apply(org.docx4j.wml.P element)
      Overrides:
      apply in class org.docx4j.utils.TraversalUtilVisitor<org.docx4j.wml.P>
    • paragraphs

      public List<org.docx4j.wml.P> paragraphs()
      Returns the list of collected paragraphs that matched the pattern.
      Returns:
      an unmodifiable list of paragraphs matching the specified pattern