Class AbstractJStachio

java.lang.Object
io.jstach.jstachio.spi.AbstractJStachio
All Implemented Interfaces:
JStachio, Renderer<Object>, JStachioExtensions.Provider
Direct Known Subclasses:
SpringJStachio

public abstract class AbstractJStachio extends Object implements JStachio, JStachioExtensions.Provider
An abstract jstachio that just needs a JStachioExtensions container.

To extend just override JStachioExtensions.Provider.extensions().

Author:
agentgt
See Also:
  • Constructor Details

  • Method Details

    • execute

      public void execute(Object model, Appendable appendable) throws IOException
      Description copied from interface: JStachio
      Finds a template by using the models class if possible and then applies filtering and then finally render the model by writing to the appendable.

      Renders the passed in model.

      Specified by:
      execute in interface JStachio
      Specified by:
      execute in interface Renderer<Object>
      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

      Description copied from interface: JStachio
      Finds a template by using the models class if possible and then applies filtering and then finally render the model by writing to the StringBuilder.

      A convenience method that does not throw IOException when using StringBuilder.

      Specified by:
      execute in interface JStachio
      Specified by:
      execute in interface Renderer<Object>
      Parameters:
      model - a model assumed never to be null.
      sb - should never be null.
      Returns:
      the passed in StringBuilder.
    • execute

      public String execute(Object model)
      Description copied from interface: JStachio
      Finds a template by using the models class if possible and then applies filtering and then finally render the model to a String.

      Convenience method that directly renders the model as a String.

      Specified by:
      execute in interface JStachio
      Specified by:
      execute in interface Renderer<Object>
      Parameters:
      model - never null.
      Returns:
      the rendered model.
    • supportsType

      public boolean supportsType(Class<?> modelType)
      Description copied from interface: JStachio
      Determines if this jstachio can render the model type (the class annotated by JStache).
      Specified by:
      supportsType in interface JStachio
      Parameters:
      modelType - the models class (the one annotated with JStache and not the Templates class)
      Returns:
      true if this jstachio can render instances of modelType