Class TemplateBody<T>

java.lang.Object
io.micronaut.email.template.TemplateBody<T>
Type Parameters:
T - HTML model
All Implemented Interfaces:
Body

public class TemplateBody<T> extends Object implements Body
Email HTML Body backed by a template.
Since:
1.0
Author:
Sergio del Amo
  • Constructor Details

    • TemplateBody

      public TemplateBody(@Nullable @Nullable String view, @Nullable T model)
      Body HTML with view name and model.
      Parameters:
      view - view name to be rendered
      model - Model to be rendered against the view
    • TemplateBody

      public TemplateBody(@NonNull @NonNull io.micronaut.views.ModelAndView<T> modelAndView)
      Parameters:
      modelAndView - Emails Template's name and model for html
    • TemplateBody

      public TemplateBody(@NonNull @NonNull BodyType bodyType, @Nullable @Nullable String view, @Nullable T model)
      Parameters:
      view - View name to be rendered
      model - Model to be rendered against the view
      bodyType - The content type of the template
    • TemplateBody

      public TemplateBody(@NonNull @NonNull BodyType bodyType, @NonNull @NonNull io.micronaut.views.ModelAndView<T> modelAndView)
      Parameters:
      modelAndView - Emails Template's name and model for html
      bodyType - The content type of the template
  • Method Details

    • getModelAndView

      @NonNull public @NonNull io.micronaut.views.ModelAndView<T> getModelAndView()
      Returns:
      The model and view
    • setBody

      public void setBody(String body)
      Parameters:
      body - The result of the view being rendered
    • get

      @NonNull public @NonNull Optional<String> get(@NonNull @NonNull BodyType bodyType)
      Specified by:
      get in interface Body