Interface IContext

All Known Subinterfaces:
IEngineContext, IExpressionContext, ITemplateContext, IWebContext
All Known Implementing Classes:
AbstractContext, AbstractEngineContext, AbstractExpressionContext, Context, EngineContext, ExpressionContext, WebContext, WebEngineContext, WebExpressionContext

public interface IContext

Interface implemented by objects containing the context variables needed by the template engine in order to process templates, besides other info like locale or (in web environments) Servlet-API artifacts.

Note a class with this name existed since 1.0, but it was completely reimplemented in Thymeleaf 3.0

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

    Modifier and Type
    Method
    Description
    boolean
    Checks whether a specific variable is already contained in this context or not.
    Returns the locale that should be used for processing the template.
    Retrieve a specific variable, by name.
    Get a list with all the names of variables contained at this context.
  • Method Details

    • getLocale

      Locale getLocale()

      Returns the locale that should be used for processing the template.

      Returns:
      the locale to be used.
    • containsVariable

      boolean containsVariable(String name)

      Checks whether a specific variable is already contained in this context or not.

      Parameters:
      name - the name of the variable to be checked.
      Returns:
      true if the variable is already contained, false if not.
    • getVariableNames

      Set<String> getVariableNames()

      Get a list with all the names of variables contained at this context.

      Returns:
      the variable names.
    • getVariable

      Object getVariable(String name)

      Retrieve a specific variable, by name.

      Parameters:
      name - the name of the variable to be retrieved.
      Returns:
      the variable's value.