Package io.vertx.ext.web.common.template

## Interface TemplateEngine

- All Known Subinterfaces:
    `FreeMarkerTemplateEngine`, `HandlebarsTemplateEngine`, `MVELTemplateEngine`, `PebbleTemplateEngine`, `PugTemplateEngine`, `RockerTemplateEngine`, `ThymeleafTemplateEngine`
  All Known Implementing Classes:
    `CachingTemplateEngine`

      public interface TemplateEngine

  A template template uses a specific template and the data in a routing context to render a resource into a buffer.

  Concrete implementations exist for several well-known template engines.

  Author:
    Tim Fox

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `clearCache()` | Clears any internal caches used by this engine.
    `default Future<Buffer>` | `render​(JsonObject context, String templateFileName)` | Render the template.
    `Future<Buffer>` | `render​(Map<String,​Object> context, String templateFileName)` | Render the template.
    `default <T> T` | `unwrap()` | Returns the underlying engine, so further configurations or customizations may be applied.

- - ### Method Detail

    - #### render

          default Future<Buffer> render​(JsonObject context,
                                        String templateFileName)

      Render the template. Template engines that support partials/fragments should extract the template base path from the template filename up to the last file separator. Some engines support localization, for these engines, there is a predefined key "lang" to specify the language to be used in the localization, the format should follow the standard locale formats e.g.: "en-gb", "pt-br", "en".
      Parameters:
        `context` - the routing context
        `templateFileName` - the template file name to use
      Returns:
        a future notified with a result containing the buffer or a failure

    - #### render

          Future<Buffer> render​(Map<String,​Object> context,
                                String templateFileName)

      Render the template. Template engines that support partials/fragments should extract the template base path from the template filename up to the last file separator. Some engines support localization, for these engines, there is a predefined key "lang" to specify the language to be used in the localization, the format should follow the standard locale formats e.g.: "en-gb", "pt-br", "en".
      Parameters:
        `context` - the routing context
        `templateFileName` - the template file name to use
      Returns:
        a future notified with a result containing the buffer or a failure

    - #### unwrap

          default <T> T unwrap()
                        throws ClassCastException

      Returns the underlying engine, so further configurations or customizations may be applied.
      Type Parameters:
        `T` - the engine object type.
      Returns:
        the engine instance.
      Throws:
        `ClassCastException` - when the expected type does not match the internal type.

    - #### clearCache

          void clearCache()

      Clears any internal caches used by this engine. For most engines this means clearing the vert.x cache, implementations that do not use vert.x as a cache should clear their own cache.