Class TemplateConfiguration

java.lang.Object
freemarker.core.Configurable
freemarker.core.TemplateConfiguration
All Implemented Interfaces:
ParserConfiguration

public final class TemplateConfiguration extends Configurable implements ParserConfiguration
Used for customizing the configuration settings for individual Template-s (or rather groups of templates), relatively to the common setting values coming from the Configuration. This was designed with the standard template loading mechanism of FreeMarker in mind (Configuration.getTemplate(String) and TemplateCache), though can also be reused for custom template loading and caching solutions.

Note on the locale setting: When used with the standard template loading/caching mechanism ( Configuration.getTemplate(String) and its overloads), localized lookup happens before the locale specified here could have effect. The locale will be only set in the template that the localized lookup has already found.

Note on the encoding setting encoding: See setEncoding(String).

Note that the result value of the reader methods (getter and "is" methods) is usually not useful unless the value of that setting was already set on this object. Otherwise you will get the value from the parent Configuration, or an IllegalStateException before this object is associated to a Configuration.

If you are using this class for your own template loading and caching solution, rather than with the standard one, you should be aware of a few more details:

Since:
2.3.24
See Also:
Template(String, String, Reader, Configuration, ParserConfiguration, String)