Interface Renderer<T>

Type Parameters:
T - the model type
All Known Subinterfaces:
ContextJStachio, JStachio, Template<T>, Template.EncodedTemplate<T>, ViewableTemplate<T>
All Known Implementing Classes:
AbstractJStachio, ExampleModelRenderer, HelloModelAndViewView, HelloModelView, HelloModelView, MessagePageRenderer, MessagePageRenderer, SpringJStachio

public interface Renderer<T>
Renders models of type T by writing to an Appendable. Implementations should be generally stateless and threadsafe.
  • Method Summary

    Modifier and Type
    Method
    Description
    default String
    execute(T model)
    Convenience method that directly renders the model as a String.
    <A extends Output<E>, E extends Exception>
    A
    execute(T model, A appendable)
    Renders the passed in model.
    default void
    execute(T model, Appendable appendable)
    Renders the passed in model.
    execute(T model, StringBuilder sb)
    A convenience method that does not throw IOException when using StringBuilder.
  • Method Details

    • execute

      <A extends Output<E>, E extends Exception> A execute(T model, A appendable) throws E
      Renders the passed in model.
      Type Parameters:
      A - output type
      E - error type
      Parameters:
      model - a model assumed never to be null.
      appendable - the output to write to.
      Returns:
      the output passed in returned for convenience.
      Throws:
      E - if there is an error writing to the output
    • execute

      default void execute(T model, Appendable appendable) throws IOException
      Renders the passed in model.
      Parameters:
      model - a model assumed never to be null.
      appendable - the appendable to write to.
      Throws:
      IOException - if there is an error writing to the appendable
    • execute

      default StringBuilder execute(T model, StringBuilder sb)
      A convenience method that does not throw IOException when using StringBuilder.
      Parameters:
      model - a model assumed never to be null.
      sb - should never be null.
      Returns:
      the passed in StringBuilder.
    • execute

      default String execute(T model)
      Convenience method that directly renders the model as a String.
      Parameters:
      model - never null.
      Returns:
      the rendered model.