Interface JStachioFilter.FilterChain

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

public static interface JStachioFilter.FilterChain
A fully composed chain that renders a model by applying filtering.
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.
      model - a model assumed never to be null.
      appendable - the appendable to write to.
      IOException - if there is an error writing to the appendable
    • 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.
      model - the model that would be rendered
      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.
      chain - process will be used when the template is executed.
      templateInfo - template info to use if the filter chain is not a template.
      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.

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