Interface TemplatingEngine

All Known Implementing Classes:
SpincastPebbleTemplatingEngine

public interface TemplatingEngine
Component that "evaluates" some templates or inline content, using some parameters. The most frequent use of this is to generate an HTML page to render.
  • Method Details

    • evaluate

      String evaluate(String content)
      Evaluates the content, without parameters.

      Uses the default Locale.

    • evaluate

      String evaluate(String content, Map<String,Object> params)
      Evaluates the content, using the given parameters. Uses the default Locale.
    • evaluate

      String evaluate(String content, Map<String,Object> params, Locale locale)
      Evaluates the content, using the given parameters. Uses the specified Locale.
    • evaluate

      String evaluate(String content, JsonObject jsonObject)
      Evaluates the content, using the given parameters. specified as a JsonObject. Uses the default Locale.
    • evaluate

      String evaluate(String content, JsonObject jsonObject, Locale locale)
      Evaluates the content, using the given parameters. specified as a JsonObject. Uses the specified Locale.
    • fromTemplate

      String fromTemplate(String templatePath, Map<String,Object> params)
      Evaluates a template using the given parameters. Uses the default Locale.
      Parameters:
      templatePath - must be a classpath's relative path.
    • fromTemplate

      String fromTemplate(String templatePath, Map<String,Object> params, Locale locale)
      Evaluates a template using the given parameters. Uses the specified Locale.
      Parameters:
      templatePath - must be a classpath's relative path.
    • fromTemplate

      String fromTemplate(String templatePath, JsonObject jsonObject)
      Evaluates a template using the parameters specified as a JsonObject. Uses the default Locale.
      Parameters:
      templatePath - must be a classpath's relative path.
    • fromTemplate

      String fromTemplate(String templatePath, JsonObject jsonObject, Locale locale)
      Evaluates a template using the parameters specified as a JsonObject. Uses the specified Locale.
      Parameters:
      templatePath - must be a classpath's relative path.
    • fromTemplate

      String fromTemplate(String templatePath, boolean isClasspathPath, Map<String,Object> params)
      Evaluates a template using the given parameters. Uses the default Locale.
      Parameters:
      isClasspathPath - if true, the 'templatePath' is considered as a classpath's relative path. If false, it is considered as an absolute file system path.
    • fromTemplate

      String fromTemplate(String templatePath, boolean isClasspathPath, Map<String,Object> params, Locale locale)
      Evaluates a template using the given parameters. Uses the specified Locale.
      Parameters:
      isClasspathPath - if true, the 'templatePath' is considered as a classpath's relative path. If false, it is considered as an absolute file system path.
    • fromTemplate

      String fromTemplate(String templatePath, boolean isClasspathPath, JsonObject jsonObject)
      Evaluates a template using the parameters specified as a JsonObject. Uses the default Locale.
      Parameters:
      isClasspathPath - if true, the 'templatePath' is considered as a classpath's relative path. If false, it is considered as an absolute file system path.
    • fromTemplate

      String fromTemplate(String templatePath, boolean isClasspathPath, JsonObject jsonObject, Locale locale)
      Evaluates a template using the parameters specified as a JsonObject. Uses the specified Locale.
      Parameters:
      isClasspathPath - if true, the 'templatePath' is considered as a classpath's relative path. If false, it is considered as an absolute file system path.
    • createPlaceholder

      String createPlaceholder(String variable)
      Creates a placeholder using the current templating engine implementation.

      This is mainly useful for the tests, which don't know in advance which templating engine will be used, so which syntax to use for the placeholders.

      For example, using Pebble, a call to createPlaceholder("name") will result in "{{name}}" (without the quotes).