Class FreemarkerDispatcher.Builder

java.lang.Object
org.apache.juneau.rest.server.view.freemarker.FreemarkerDispatcher.Builder
Enclosing class:
FreemarkerDispatcher

public static class FreemarkerDispatcher.Builder extends Object
  • Constructor Details

  • Method Details

    • basePath

      Sets the classpath base path under which template resources are resolved.
      Parameters:
      value - The base path. null or blank values reset to the default FreemarkerDispatcher.DEFAULT_BASE_PATH.
      Returns:
      This object.
    • templateSuffix

      Sets the suffix to append to template names that don't already end with it (idempotent).
      Parameters:
      value - The new suffix. null resets to FreemarkerDispatcher.DEFAULT_TEMPLATE_SUFFIX.
      Returns:
      This object.
    • cacheTemplates

      Sets the template-cache flag for the bridge-default configuration.
      Parameters:
      value - The cache flag.
      Returns:
      This object.
    • exposeFields

      Sets whether the bridge-default ObjectWrapper exposes public fields (not just JavaBean getters) to templates.

      Defaults to true so simple view-model DTOs written with public fields and no getters render their field values instead of silently resolving to null/missing. Has no effect once objectWrapper has been called with a non-null value — the explicit wrapper always wins.

      Parameters:
      value - The field-exposure flag.
      Returns:
      This object.
    • objectWrapper

      public FreemarkerDispatcher.Builder objectWrapper(freemarker.template.ObjectWrapper value)
      Sets a fully custom ObjectWrapper for the bridge-default configuration, overriding exposeFields(boolean) entirely.

      Escape hatch for consumers who need full control (e.g. a BeansWrapper with custom method/property exposure, or a third-party wrapper) without hand-rolling and registering a whole replacement Configuration bean.

      Parameters:
      value - The object wrapper. null reverts to the bridge-built DefaultObjectWrapper (per exposeFields(boolean)).
      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.
    • isExposeFields

      public boolean isExposeFields()
      Reads the current field-exposure setting (test/inspection helper).
      Returns:
      The field-exposure flag.
    • getObjectWrapper

      public freemarker.template.ObjectWrapper getObjectWrapper()
      Reads the current object-wrapper override (test/inspection helper).
      Returns:
      The object wrapper override, or null if none has been set.
    • build

      Returns:
      A new FreemarkerDispatcher instance.