Class FreemarkerDispatcher.Builder
java.lang.Object
org.apache.juneau.rest.server.view.freemarker.FreemarkerDispatcher.Builder
- Enclosing class:
- FreemarkerDispatcher
Builder for
FreemarkerDispatcher.-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBuilder()Constructor — package access forFreemarkerDispatcher.create(). -
Method Summary
Modifier and TypeMethodDescriptionSets the classpath base path under which template resources are resolved.build()Builds theFreemarkerDispatcher.cacheTemplates(boolean value) Sets the template-cache flag for the bridge-default configuration.exposeFields(boolean value) Sets whether the bridge-defaultObjectWrapperexposes public fields (not just JavaBean getters) to templates.Reads the current base path setting (test/inspection helper).freemarker.template.ObjectWrapperReads the current object-wrapper override (test/inspection helper).Reads the current template-suffix setting (test/inspection helper).booleanReads the current cache-templates setting (test/inspection helper).booleanReads the current field-exposure setting (test/inspection helper).objectWrapper(freemarker.template.ObjectWrapper value) Sets a fully customObjectWrapperfor the bridge-default configuration, overridingexposeFields(boolean)entirely.templateSuffix(String value) Sets the suffix to append to template names that don't already end with it (idempotent).
-
Constructor Details
-
Builder
protected Builder()Constructor — package access forFreemarkerDispatcher.create().
-
-
Method Details
-
basePath
Sets the classpath base path under which template resources are resolved.- Parameters:
value- The base path.nullor blank values reset to the defaultFreemarkerDispatcher.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.nullresets toFreemarkerDispatcher.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-defaultObjectWrapperexposes public fields (not just JavaBean getters) to templates.Defaults to
trueso simple view-model DTOs written with public fields and no getters render their field values instead of silently resolving tonull/missing. Has no effect onceobjectWrapperhas been called with a non-nullvalue — the explicit wrapper always wins.- Parameters:
value- The field-exposure flag.- Returns:
- This object.
-
objectWrapper
Sets a fully customObjectWrapperfor the bridge-default configuration, overridingexposeFields(boolean)entirely.Escape hatch for consumers who need full control (e.g. a
BeansWrapperwith custom method/property exposure, or a third-party wrapper) without hand-rolling and registering a whole replacementConfigurationbean.- Parameters:
value- The object wrapper.nullreverts to the bridge-builtDefaultObjectWrapper(perexposeFields(boolean)).- Returns:
- This object.
-
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
Reads the current cache-templates setting (test/inspection helper).- Returns:
- The cache flag.
-
isExposeFields
Reads the current field-exposure setting (test/inspection helper).- Returns:
- The field-exposure flag.
-
getObjectWrapper
Reads the current object-wrapper override (test/inspection helper).- Returns:
- The object wrapper override, or
nullif none has been set.
-
build
Builds theFreemarkerDispatcher.- Returns:
- A new
FreemarkerDispatcherinstance.
-