Package io.jstach.jstachio.context


@NonNullByDefault package io.jstach.jstachio.context
JStachio extended Mustache context support for context stack as well as Map and JSON tree like models.

Models traditionally in web applications and template engines in general are Map based. JStachio prefers stronger typing than that however there are many scenarios where Map approach might be better for legacy reasons or because of variables that need to be added after the model has been created. An example is web applications where request based attributes may need to be available to the model such as CSRF token.

A special JStachio allows you to pass in a context that will be bound with "@context" as the variable name.

On the otherhand if the desire is to just render Map as a root object and are willing to accept the lack of type checking one can make an annotated JStache model that extends ObjectContext.

None of this behavior in this package is available to generated code that is JStacheType.STACHE. By default JStacheType.JSTACHIO templates are context aware. To disable use JStacheFlags.Flag.CONTEXT_SUPPORT_DISABLE.

API Note
Much of this package is an experimental extension of JStachio and while we try to limit public API additions the proper use cases and design are still ongoing.