Interface ITemplateBoundariesStructureHandler

  • All Known Implementing Classes:
    TemplateBoundariesStructureHandler

    public interface ITemplateBoundariesStructureHandler

    Structure handler class meant to be used by ITemplateBoundariesProcessor implementations.

    Structure handlers allow processors to instruct the engine to perform a series of actions that cannot be done directly from the processors themselves, usually because these actions are applied or have effects on scopes broader than the processed events themselves.

    Since:
    3.0.0
    Author:
    Daniel Fernández
    See Also:
    ITemplateBoundariesProcessor
    • Method Detail

      • reset

        void reset()

        Resets all actions specified so far for the current processor execution.

      • setLocalVariable

        void setLocalVariable​(String name,
                              Object value)

        Instructs the engine to set a new local variable.

        Parameters:
        name - the name of the variable.
        value - the value of the variable.
      • removeLocalVariable

        void removeLocalVariable​(String name)

        Instructs the engine to remove a local variable.

        Parameters:
        name - the name of the variable.
      • setSelectionTarget

        void setSelectionTarget​(Object selectionTarget)

        Instructs the engine to set a new selection target.

        The selection target is the object on which selection expressions (*{...}) are executed. In the Standard Dialect, this selection target is usually modified by means of the th:object attribute, but custom processors can do it too. Note the selection target has the same scope as a local variable, and will therefore be accessible only inside the body of the element being processed.

        See ITemplateContext.getSelectionTarget()

        Parameters:
        selectionTarget - the selection target to be set.
      • setInliner

        void setInliner​(IInliner inliner)

        Instructs the engine to set a new inliner.

        Inliners are used for processing all text nodes (IText events) appearing in the body of the element being processed. This is the mechanism used by the th:inline attribute to enable inlining in any of the specified modes (text, javascript, etc).

        See ITemplateContext.getInliner()

        Parameters:
        inliner - the inliner.
      • insert

        void insert​(String text,
                    boolean processable)

        Instructs the engine to insert the specified text.

        If the processed event is a ITemplateStart event, then the text will be inserted at the beginning of the template (just after the template start event). On the other hand, if the processed event is a ITemplateEnd event, then the text will be inserted at the end of the template (just before the template end event).

        Parameters:
        text - the text to be inserted.
        processable - whether the inserted text should be considered processable or not.
      • insert

        void insert​(IModel model,
                    boolean processable)

        Instructs the engine to insert the specified model.

        If the processed event is a ITemplateStart event, then the model will be inserted at the beginning of the template (just after the template start event). On the other hand, if the processed event is a ITemplateEnd event, then the model will be inserted at the end of the template (just before the template end event).

        Parameters:
        model - the model to be inserted.
        processable - whether the inserted text should be considered processable or not.