Class MustacheMixin.Builder

java.lang.Object
org.apache.juneau.rest.server.view.mustache.MustacheMixin.Builder
All Implemented Interfaces:
ViewMixinBuilder<MustacheMixin.Builder>
Enclosing class:
MustacheMixin

public static class MustacheMixin.Builder extends Object implements ViewMixinBuilder<MustacheMixin.Builder>
Builder for MustacheMixin.

Mirrors MustacheDispatcher.Builder's configuration methods on its own surface and forwards each call into a held MustacheDispatcher.Builder (worker-bean composition). Implements ViewMixinBuilder so basePath(String) and cacheTemplates(boolean) are guaranteed to transfer to the sibling JSP / Thymeleaf / FreeMarker bridge builders.

  • Constructor Details

  • Method Details

    • basePath

      Sets the classpath base path under which template resources are resolved.

      Defaults to "/". A typical configured value is "/templates/" — the same Spring-Boot-compatible layout convention the sibling JSP / Thymeleaf bridges use.

      Specified by:
      basePath in interface ViewMixinBuilder<MustacheMixin.Builder>
      Parameters:
      value - The base path. null or blank values reset to the default MustacheMixin.DEFAULT_BASE_PATH.
      Returns:
      This object.
    • templateSuffix

      Sets the suffix to append to template names that don't already end with it (idempotent).

      Defaults to "" (no implicit suffix — literal template names). Typical configured value is ".mustache", the mustache.java convention.

      Parameters:
      value - The new suffix. null resets to MustacheMixin.DEFAULT_TEMPLATE_SUFFIX.
      Returns:
      This object.
    • cacheTemplates

      public MustacheMixin.Builder cacheTemplates(boolean value)
      Sets whether the bridge's default factory caches compiled templates.

      Defaults to true (cache forever — production-safe). Set false to enable dev hot-reload (the bridge rebuilds the factory from a fresh, empty compile-cache on every render). This setting only applies to the bridge's fallback factory; if a MustacheFactory bean is registered, its own caching behavior is honored.

      Specified by:
      cacheTemplates in interface ViewMixinBuilder<MustacheMixin.Builder>
      Parameters:
      value - The new value.
      Returns:
      This object.
    • getBasePath

      public String getBasePath()
      Reads the current base path setting (test/inspection helper).
      Returns:
      The base path. Never null.
    • getTemplateSuffix

      Reads the current template-suffix setting (test/inspection helper).
      Returns:
      The template suffix. Never null.
    • isCacheTemplates

      public boolean isCacheTemplates()
      Reads the current cache-templates setting (test/inspection helper).
      Returns:
      The cache flag.
    • build

      public MustacheMixin build()
      Builds the MustacheMixin.
      Returns:
      A new MustacheMixin instance.