public interface MustacheListener extends ConfigurationAware
Mustache
processing. A listener
instance should only be registered for one
MustacheEngine
.
Listeners are invoked in the order of their registration, except for
renderingFinished(MustacheRenderingEvent)
method which is invoked in
reverse order.
Code inside a listener may throw an unchecked exception - this aborts further processing of the template and no more listeners are invoked afterwards.
Any listener may implement optional interface
Validateable
. The validation is
performed before a MustacheEngine
is built. An
invalid listener is not put into service, i.e. it's not included in the final
list of listeners returned by
Configuration.getMustacheListeners()
.
MustacheEngineBuilder.addMustacheListener(MustacheListener)
Modifier and Type | Method and Description |
---|---|
default void |
compilationFinished(MustacheCompilationEvent event)
Notification that a
Mustache template was just compiled. |
default void |
parsingStarted(MustacheParsingEvent event)
Parsing of a
Mustache is about to start. |
default void |
renderingFinished(MustacheRenderingEvent event)
Rendering of a
Mustache is about to finish. |
default void |
renderingStarted(MustacheRenderingEvent event)
Rendering of a
Mustache is about to start. |
getConfigurationKeys, init
default void compilationFinished(MustacheCompilationEvent event)
Mustache
template was just compiled. Keep in
mind that processing of a Lambda
may also result in one-off
template compilation - see also
Lambda.isReturnValueInterpolated()
.event
- default void renderingStarted(MustacheRenderingEvent event)
Mustache
is about to start. Always use
ReleaseCallbackContainer.registerReleaseCallback(ReleaseCallback)
to release all the necessary resources.event
- default void renderingFinished(MustacheRenderingEvent event)
Mustache
is about to finish. Always use
ReleaseCallbackContainer.registerReleaseCallback(ReleaseCallback)
to release all the necessary resources.event
- default void parsingStarted(MustacheParsingEvent event)
Mustache
is about to start. Listeners are allowed to
modify the event payload, particularly the Reader
object used by
a parser to read the template contents.event
- Copyright © 2017. All rights reserved.