Interface DocxHook

All Superinterfaces:
Hook
All Known Implementing Classes:
CommentHook, TagHook

public interface DocxHook extends Hook
Interface for hooks that process specific parts of a DOCX document.
  • Method Details

    • ofHooks

      static ResetableIterator<DocxHook> ofHooks(org.docx4j.wml.ContentAccessor contentAccessor, DocxPart part)
      Creates an iterator over the hooks in the given content accessor.
      Parameters:
      contentAccessor - the content accessor to search for hooks.
      part - the document part.
      Returns:
      an iterator over the found hooks.
    • isPotentialHook

      static boolean isPotentialHook(Object o)
      Checks if the given object is a potential hook.
      Parameters:
      o - the object to check.
      Returns:
      true if it is a potential hook.
    • asHook

      static DocxHook asHook(DocxPart part, Object o)
      Converts an object to a hook.
      Parameters:
      part - the document part.
      o - the object to convert.
      Returns:
      the hook.
    • isType

      static boolean isType(org.docx4j.wml.CTSmartTagRun tag, String type, String typeKey)
      Checks if the given tag is of the specified type.
      Parameters:
      tag - the tag to check.
      type - the expected type value.
      typeKey - the attribute name for the type.
      Returns:
      true if the tag matches the type.
    • newCommentHook

      static DocxHook newCommentHook(DocxPart part, org.docx4j.wml.CTSmartTagRun tag)
      Creates a new comment hook.
      Parameters:
      part - the document part.
      tag - the tag.
      Returns:
      the comment hook.
    • run

      boolean run(EngineFactory engineFactory, ContextRoot contextTree, OfficeStamperEvaluationContextFactory officeStamperContextFactory)
      Executes the hook's logic within the context of a document processing flow.
      Parameters:
      engineFactory - a factory responsible for creating instances of the Engine class, which may be used during the execution of the hook's logic
      contextTree - the root of the context tree, representing the hierarchical structure of context branches available during document processing
      officeStamperContextFactory - a factory for creating evaluation contexts, which are used to evaluate expressions and handle dynamic behavior during the document processing flow
      Returns:
      true if the execution of the hook was successful, otherwise false