Interface Renderer<T>

Type Parameters:
T - the model type
All Known Subinterfaces:
JStachio, Template<T>
All Known Implementing Classes:
AbstractJStachio, HelloModelView, HelloModelView, MessagePageRenderer, MessagePageRenderer, SpringJStachio
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface 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.
    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

      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.