Class ProcessorContext

java.lang.Object
pro.verron.officestamper.api.ProcessorContext

public final class ProcessorContext extends Object

Represents a context within a document processing operation.

This class encapsulates key elements involved in the processing of a specific part of a WordprocessingMLPackage-based document, such as a part of the document, a specific paragraph, an associated comment, and an expression being evaluated or processed.

The ProcessorContext provides structured access to these elements, enabling seamless document traversal, manipulation, and analysis during processing workflows.

  • Constructor Details

    • ProcessorContext

      public ProcessorContext(DocxPart part, Paragraph paragraph, Comment comment, String expression, ContextTree contextTree)
      Constructs a ProcessorContext.
      Parameters:
      part - The DocxPart representing a specific part of the document being processed.
      paragraph - The Paragraph associated with the processing context.
      comment - The Comment that is relevant to the current processing context.
      expression - A String containing the expression or directive being evaluated.
      contextTree - The ContextTree managing the hierarchical scopes for this context.
  • Method Details

    • contentIterator

      public ResetableIterator<Object> contentIterator()
      Returns an iterator over the content associated with the current comment's range.
      Returns:
      a ResetableIterator of Object representing the content within the comment's scope.
    • comment

      public Comment comment()
      Returns the comment associated with the current processing context.
      Returns:
      the Comment object.
    • tableRow

      public Optional<Table.Row> tableRow()
      Returns the table row containing the current paragraph, if any.
      Returns:
      an Optional containing the Table.Row, or empty if the paragraph is not in a table row.
    • table

      public Optional<Table> table()
      Returns the table containing the current paragraph, if any.
      Returns:
      an Optional containing the Table, or empty if the paragraph is not in a table.
    • part

      public DocxPart part()
      Returns the document part currently being processed.
      Returns:
      the DocxPart object.
    • paragraph

      public Paragraph paragraph()
      Returns the paragraph currently being processed.
      Returns:
      the Paragraph object.
    • expression

      public String expression()
      Returns the expression or directive currently being evaluated.
      Returns:
      the expression as a String.
    • contextHolder

      public ContextTree contextHolder()
      Returns the context tree managing the hierarchical scopes for this context.
      Returns:
      the ContextTree object.