public class TemplateContextFactory extends Object
TemplateContext factory implementation that creates
TemplateContexts with Accessors, Filters,
Plugins, TemplateProviders, and arbitrary objects that are
set on all created TemplateContexts.| Constructor and Description |
|---|
TemplateContextFactory() |
| Modifier and Type | Method and Description |
|---|---|
void |
addAccessor(Class<?> clazz,
Accessor accessor)
Adds an accessor that will be added to all created templates.
|
void |
addFilter(String name,
Filter filter)
Adds the given filter to all created templates.
|
void |
addPlugin(String name,
Plugin plugin)
Adds the given plugin to all created templates.
|
void |
addProvider(TemplateProvider templateProvider)
Sets the template provider that is set on all created templates.
|
void |
addTemplateObject(String name,
Object object)
Adds an object that will be stored in all created templates.
|
TemplateContext |
createTemplateContext()
Creates a new template context that contains the accessors, filters,
plugins, template providers, and objects set in this factory.
|
static TemplateContextFactory |
getInstance()
Returns the static default instance of this template factory.
|
public void addAccessor(Class<?> clazz, Accessor accessor)
clazz - The class to add the accessor foraccessor - The accessor to addpublic void addFilter(String name, Filter filter)
name - The name of the filterfilter - The filter to addpublic void addPlugin(String name, Plugin plugin)
name - The name of the pluginplugin - The plugin to addpublic void addProvider(TemplateProvider templateProvider)
templateProvider - The template provider to setpublic void addTemplateObject(String name, Object object)
name - The name of the template variableobject - The object to storepublic static TemplateContextFactory getInstance()
public TemplateContext createTemplateContext()
Copyright © 2026. All rights reserved.