Class PebbleTemplateEngine

java.lang.Object
io.vertx.mutiny.ext.web.common.template.TemplateEngine
io.vertx.mutiny.ext.web.templ.pebble.PebbleTemplateEngine
All Implemented Interfaces:
MutinyDelegate

public class PebbleTemplateEngine extends TemplateEngine implements MutinyDelegate
A template engine that uses the Pebble library. The unwrap() shall return an object of class PebbleEngine

NOTE: This class has been automatically generated from the original non Mutiny-ified interface.

Author:
Dan Kristensen
See Also:
  • PebbleTemplateEngine
  • Field Details

  • Constructor Details

    • PebbleTemplateEngine

      public PebbleTemplateEngine(io.vertx.ext.web.templ.pebble.PebbleTemplateEngine delegate)
      Create a new instance of PebbleTemplateEngine delegating to the given (non-null) instance of PebbleTemplateEngine.
    • PebbleTemplateEngine

      public PebbleTemplateEngine(Object delegate)
  • Method Details

    • getDelegate

      public io.vertx.ext.web.templ.pebble.PebbleTemplateEngine getDelegate()
      Get the delegate instance.

      This method returns the instance on which this shim is delegating the calls. And so, give you access to the bare API.

      Specified by:
      getDelegate in interface MutinyDelegate
      Overrides:
      getDelegate in class TemplateEngine
      Returns:
      the delegate instance
    • render

      @CheckReturnValue public io.smallrye.mutiny.Uni<io.vertx.core.buffer.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".

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Overrides:
      render in class TemplateEngine
      Parameters:
      context - the routing context
      templateFileName - the template file name to use
      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • TemplateEngine.render(Map, String)
    • renderAndAwait

      public io.vertx.core.buffer.Buffer renderAndAwait(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".

      Unlike the bare Vert.x variant, this method returns a Buffer. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

      Overrides:
      renderAndAwait in class TemplateEngine
      Parameters:
      context - the routing context
      templateFileName - the template file name to use
      Returns:
      The operation result
      See Also:
      • TemplateEngine.render(Map, String)
    • renderAndForget

      public PebbleTemplateEngine renderAndForget(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".

      Unlike the bare Vert.x variant, this method ignores the Buffer result or any failure.

      Overrides:
      renderAndForget in class TemplateEngine
      Parameters:
      context - the routing context
      templateFileName - the template file name to use
      Returns:
      The current instance to chain operations if needed.
      See Also:
      • TemplateEngine.render(Map, String)
    • render

      @CheckReturnValue public io.smallrye.mutiny.Uni<io.vertx.core.buffer.Buffer> render(io.vertx.core.json.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".

      Unlike the bare Vert.x variant, this method returns a Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.

      Don't forget to subscribe on it to trigger the operation.

      Overrides:
      render in class TemplateEngine
      Parameters:
      context - the routing context
      templateFileName - the template file name to use
      Returns:
      A Uni representing the asynchronous result of this operation.
      See Also:
      • TemplateEngine.render(JsonObject, String)
    • renderAndAwait

      public io.vertx.core.buffer.Buffer renderAndAwait(io.vertx.core.json.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".

      Unlike the bare Vert.x variant, this method returns a Buffer. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

      Overrides:
      renderAndAwait in class TemplateEngine
      Parameters:
      context - the routing context
      templateFileName - the template file name to use
      Returns:
      The operation result
      See Also:
      • TemplateEngine.render(JsonObject, String)
    • renderAndForget

      public PebbleTemplateEngine renderAndForget(io.vertx.core.json.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".

      Unlike the bare Vert.x variant, this method ignores the Buffer result or any failure.

      Overrides:
      renderAndForget in class TemplateEngine
      Parameters:
      context - the routing context
      templateFileName - the template file name to use
      Returns:
      The current instance to chain operations if needed.
      See Also:
      • TemplateEngine.render(JsonObject, String)
    • create

      public static PebbleTemplateEngine create(Vertx vertx)
      Create a template engine using defaults
      Returns:
      the engine
    • create

      public static PebbleTemplateEngine create(Vertx vertx, String extension)
      Create a template engine using defaults
      Returns:
      the engine
    • create

      public static PebbleTemplateEngine create(Vertx vertx, io.pebbletemplates.pebble.PebbleEngine engine)
      Create a template engine using a custom Builder, e.g. if you want use custom Filters or Functions.
      Returns:
      the engine
    • create

      public static PebbleTemplateEngine create(Vertx vertx, String extension, io.pebbletemplates.pebble.PebbleEngine engine)
      Create a template engine using a custom Builder, e.g. if you want use custom Filters or Functions.
      Returns:
      the engine
    • unwrap

      public io.pebbletemplates.pebble.PebbleEngine unwrap()
      Description copied from class: TemplateEngine
      Returns the underlying engine, so further configurations or customizations may be applied or null when the engine cannot unwrap it.
      Overrides:
      unwrap in class TemplateEngine
      Returns:
      the engine instance.
    • newInstance

      public static PebbleTemplateEngine newInstance(io.vertx.ext.web.templ.pebble.PebbleTemplateEngine delegate)
      Creates a new instance of the PebbleTemplateEngine.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class TemplateEngine
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class TemplateEngine
    • toString

      public String toString()
      Overrides:
      toString in class TemplateEngine