Class TemplatedBuilder<T extends Renderable>

java.lang.Object
io.micronaut.views.TemplatedBuilder<T>
Type Parameters:
T - The class to be built
Direct Known Subclasses:
TurboFrame.Builder

public abstract class TemplatedBuilder<T extends Renderable> extends Object
Abstract class to be used by builders which support templates.
Since:
3.4.0
Author:
Sergio del Amo
  • Constructor Details

    • TemplatedBuilder

      public TemplatedBuilder()
  • Method Details

    • build

      public abstract T build()
      Returns:
      Build instance
    • getTemplateView

      @NonNull public @NonNull Optional<String> getTemplateView()
      Returns:
      The TurboStream template view name.
    • getTemplateModel

      @NonNull public @NonNull Optional<Object> getTemplateModel()
      Returns:
      The TurboStream template model.
    • getTemplate

      @Nullable public @Nullable Object getTemplate()
      Returns:
      The Template
    • template

      @NonNull public @NonNull TemplatedBuilder<T> template(@NonNull @NonNull String view, Object model)
      Sets the template with a View and Model.
      Parameters:
      view - The View name
      model - The Model
      Returns:
      The Builder
    • template

      @NonNull public @NonNull TemplatedBuilder<T> template(@NonNull @NonNull String html)
      Sets the Turbo Frame with a String. E.g. HTML.
      Parameters:
      html - The turbo frame content
      Returns:
      The Builder
    • template

      @NonNull public @NonNull TemplatedBuilder<T> template(@NonNull @NonNull io.micronaut.core.io.Writable writable)
      Sets the Turbo frame content with a Writable.
      Parameters:
      writable - The template as a Writable.
      Returns:
      The Builder
    • templateView

      @NonNull public @NonNull TemplatedBuilder<T> templateView(@NonNull @NonNull String templateView)
      Sets the template's view name.
      Parameters:
      templateView - The View name
      Returns:
      The Builder
    • templateModel

      @NonNull public @NonNull TemplatedBuilder<T> templateModel(@NonNull @NonNull Object templateModel)
      Sets the template's model.
      Parameters:
      templateModel - template model.
      Returns:
      The Builder