Interface JStachioFilter

All Superinterfaces:
All Known Implementing Classes:

public non-sealed interface JStachioFilter extends JStachioExtension
Advises, intercepts or filters a template before being rendered.

This extension point is largely to support dynamic updates of templates where a template is being edited while the JVM is fully loaded and we need to intercept the call to provide rendering of the updated template.

The extension will only be executed if JStachio render (and execute) methods are used and not the generated classes render methods.

When JStachio renders a model through the runtime it:

  1. Loads the template. In some cases it may use reflection and thus TemplateInfo may not be a generated Template.
  2. Loads the composite filter which is all the filters combined in order (see order()).
  3. Creates the filter chain with the loaded template.
  4. Then tells the chain to process the rendering.
API Note
⚠ WARNING! While this extension point is public API it is recommended you do not use it. It is less stable than the rest of the API and is subject to change in the future. Implementations should be threadsafe!
  • Method Details

    • filter

      Advises or filters a previously created filter.
      template - info about the template
      previous - the function returned early in the chain.
      an advised render function or often the previous render function if no advise is needed.
    • order

      default int order()
      Hint on order of filter chain. The found JStachioFilters are sorted naturally (lower number comes first) based on the returned number. Thus the filter that has the greatest say is the filter with the highest number.
      default returns zero
    • compose

      Creates a composite filter of a many filters.
      filters - not null.
      a composite filter ordered by order()