Interface JStachioFilter.FilterChain

All Known Implementing Classes:
ExampleModelRenderer, HelloModelAndViewView, HelloModelView, HelloModelView, MessagePageRenderer, MessagePageRenderer
Enclosing interface:
JStachioFilter

public static interface JStachioFilter.FilterChain
A fully composed chain that renders a model by applying filtering.
Author:
agentgt
API Note
The filter chain should be stateless and threadsafe as there is no guarantee that a filter chain will be recreated for the same TemplateInfo.
  • Method Details

    • process

      void process(Object model, Output<?> appendable) throws Exception
      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
      Exception
    • isBroken

      default boolean isBroken(Object model)
      A marker method that the filter is broken and should not be used. This mainly for the filter pipeline to determine if filter should be called.
      Parameters:
      model - the model that would be rendered
      Returns:
      by default false
    • toTemplate

      static Template<?> toTemplate(JStachioFilter.FilterChain chain, TemplateInfo templateInfo)
      Converts the filter chain into a template if it is not already one.
      Parameters:
      chain - process will be used when the template is executed.
      templateInfo - template info to use if the filter chain is not a template.
      Returns:
      chain as a template
    • of

      Create the filter chain from the filter and a template by resolving the first filter.

      The first filter (previous) will be broken unless the parameter template is a JStachioFilter.FilterChain which generated renderers usually are.

      Parameters:
      filter - usually the composite filter
      template - info about the template
      Returns:
      an advised render function or often the previous render function if no advise is needed.