Package freemarker.cache
Class TemplateConfigurationFactory
- java.lang.Object
-
- freemarker.cache.TemplateConfigurationFactory
-
- Direct Known Subclasses:
ConditionalTemplateConfigurationFactory
,FirstMatchTemplateConfigurationFactory
,MergingTemplateConfigurationFactory
public abstract class TemplateConfigurationFactory extends java.lang.Object
Creates (or returns)TemplateConfiguration
-s for template sources.- Since:
- 2.3.24
-
-
Constructor Summary
Constructors Constructor Description TemplateConfigurationFactory()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract TemplateConfiguration
get(java.lang.String sourceName, java.lang.Object templateSource)
Returns (maybe creates) theTemplateConfiguration
for the given template source.Configuration
getConfiguration()
Returns the configuration this object belongs to, ornull
if it isn't yet bound to aConfiguration
.void
setConfiguration(Configuration cfg)
Binds thisTemplateConfigurationFactory
to aConfiguration
.protected abstract void
setConfigurationOfChildren(Configuration cfg)
CallsTemplateConfiguration.setParentConfiguration(Configuration)
on each enclosedTemplateConfiguration
andsetConfiguration(Configuration)
on each enclosedTemplateConfigurationFactory
objects.
-
-
-
Method Detail
-
get
public abstract TemplateConfiguration get(java.lang.String sourceName, java.lang.Object templateSource) throws java.io.IOException, TemplateConfigurationFactoryException
Returns (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:
java.io.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
public final void setConfiguration(Configuration cfg)
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
public Configuration getConfiguration()
Returns the configuration this object belongs to, ornull
if it isn't yet bound to aConfiguration
.
-
setConfigurationOfChildren
protected abstract void setConfigurationOfChildren(Configuration cfg)
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.
-
-