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
-
Method Summary
Modifier and TypeMethodDescriptionabstract TemplateConfiguration
Returns (maybe creates) theTemplateConfiguration
for the given template source.Returns the configuration this object belongs to, ornull
if it isn't yet bound to aConfiguration
.void
Binds thisTemplateConfigurationFactory
to aConfiguration
.protected abstract void
CallsTemplateConfiguration.setParentConfiguration(Configuration)
on each enclosedTemplateConfiguration
andsetConfiguration(Configuration)
on each enclosedTemplateConfigurationFactory
objects.
-
Constructor Details
-
TemplateConfigurationFactory
public TemplateConfigurationFactory()
-
-
Method Details
-
get
public abstract TemplateConfiguration get(String sourceName, Object templateSource) throws IOException, TemplateConfigurationFactoryExceptionReturns (maybe creates) theTemplateConfiguration
for 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
TemplateConfiguration
to apply, ornull
if the there's noTemplateConfiguration
for 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 thisTemplateConfigurationFactory
to aConfiguration
. Once it's bound, it can't be bound to anotherConfiguration
any more. This is automatically called byConfiguration.setTemplateConfigurations(TemplateConfigurationFactory)
. -
getConfiguration
Returns the configuration this object belongs to, ornull
if it isn't yet bound to aConfiguration
. -
setConfigurationOfChildren
CallsTemplateConfiguration.setParentConfiguration(Configuration)
on each enclosedTemplateConfiguration
andsetConfiguration(Configuration)
on each enclosedTemplateConfigurationFactory
objects. It only supposed to call these on the direct "children" of this object, not on the children of the children.
-