Package freemarker.cache
Class TemplateConfigurationFactory
java.lang.Object
freemarker.cache.TemplateConfigurationFactory
- Direct Known Subclasses:
ConditionalTemplateConfigurationFactory,FirstMatchTemplateConfigurationFactory,MergingTemplateConfigurationFactory
Creates (or returns)
TemplateConfiguration-s for template sources.- Since:
- 2.3.24
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract TemplateConfigurationReturns (maybe creates) theTemplateConfigurationfor the given template source.Returns the configuration this object belongs to, ornullif it isn't yet bound to aConfiguration.final voidBinds thisTemplateConfigurationFactoryto aConfiguration.protected abstract voidCallsTemplateConfiguration.setParentConfiguration(Configuration)on each enclosedTemplateConfigurationandsetConfiguration(Configuration)on each enclosedTemplateConfigurationFactoryobjects.
-
Constructor Details
-
TemplateConfigurationFactory
public TemplateConfigurationFactory()
-
-
Method Details
-
get
public abstract TemplateConfiguration get(String sourceName, Object templateSource) throws IOException, TemplateConfigurationFactoryException Returns (maybe creates) theTemplateConfigurationfor the given template source.- Parameters:
sourceName- The name (path) that was used forTemplateLoader.findTemplateSource(String). SeeTemplate.getSourceName()for details.templateSource- The object returned byTemplateLoader.findTemplateSource(String).- Returns:
- The
TemplateConfigurationto apply, ornullif the there's noTemplateConfigurationfor this template source. - Throws:
IOException- Typically, if there factory needs further I/O to find out more about the template source, but that fails.TemplateConfigurationFactoryException- If there's a problem that's specific to the factory logic.
-
setConfiguration
Binds thisTemplateConfigurationFactoryto aConfiguration. Once it's bound, it can't be bound to anotherConfigurationany more. This is automatically called byConfiguration.setTemplateConfigurations(TemplateConfigurationFactory). -
getConfiguration
Returns the configuration this object belongs to, ornullif it isn't yet bound to aConfiguration. -
setConfigurationOfChildren
CallsTemplateConfiguration.setParentConfiguration(Configuration)on each enclosedTemplateConfigurationandsetConfiguration(Configuration)on each enclosedTemplateConfigurationFactoryobjects. It only supposed to call these on the direct "children" of this object, not on the children of the children.
-