Class ExecutionInfo


  • public final class ExecutionInfo
    extends Object

    Expression Object providing useful information about the template being processed inside Thymeleaf Standard Expressions.

    An object of this class is usually available in variable evaluation expressions with the name #execInfo.

    Since:
    3.0.0
    Author:
    Daniel Fernández
    • Method Detail

      • getTemplateName

        public String getTemplateName()

        Returns the template name (of the leaf template).

        Note that the template name returned here corresponds with origin of the elements or nodes being currently processed. This is, if a processor is being executed for an element inserted from an external template (via a th:insert, for example), then this method will return the template mode for the template in which the inserted fragment lives, not the one it was inserted into.

        Returns:
        the template name
      • getTemplateMode

        public TemplateMode getTemplateMode()

        Returns the template mode (TemplateMode) (of the leaf template).

        Note that the TemplateMode returned here corresponds with origin of the elements or nodes being currently processed. This is, if a processor is being executed for an element inserted from an external template (via a th:insert, for example), then this method will return the template mode for the template in which the inserted fragment lives, not the one it was inserted into.

        Returns:
        the template mode
      • getProcessedTemplateName

        public String getProcessedTemplateName()

        Returns the template name of the first-level template.

        Note this template name refers to the first-level one, the one used to call the TemplateEngine itself, even if by the moment this method is called the engine is processing a fragment inserted from the first-level template (or at any other level in the hierarchy).

        Returns:
        the template name
      • getProcessedTemplateMode

        public TemplateMode getProcessedTemplateMode()

        Returns the template mode (TemplateMode) of the first-level template.

        Note this template mode refers to the first-level one, the one used to call the TemplateEngine itself, even if by the moment this method is called the engine is processing a fragment inserted from the first-level template (or at any other level in the hierarchy).

        Returns:
        the template mode
      • getTemplateNames

        public List<String> getTemplateNames()

        Returns the names of all the stack of templates appliable to the current point of execution. This will depend on which templates are inserted inside wich.

        The first-level template will appear first, and the most specific template will appear last.

        Returns:
        the stack of template names
      • getTemplateModes

        public List<TemplateMode> getTemplateModes()

        Returns the TemplateModes of all the stack of templates appliable to the current point of execution. This will depend on which templates are inserted inside wich.

        The first-level template will appear first, and the most specific template will appear last.

        Returns:
        the stack of template modes
      • getTemplateStack

        public List<TemplateData> getTemplateStack()

        Returns the template stack, containing the metadata for the first-level template being processed and also any fragments that might have been nested up to the current execution point.

        The result of this method actually corresponds to the result of ITemplateContext.getTemplateStack().

        Returns:
        the stack of TemplateData objects
      • getNow

        public Calendar getNow()

        Returns the current date and time (from the moment of template execution).

        Returns:
        the current date and time, as a Calendar