Package freemarker.cache
Class ConditionalTemplateConfigurationFactory
java.lang.Object
freemarker.cache.TemplateConfigurationFactory
freemarker.cache.ConditionalTemplateConfigurationFactory
Returns the given
TemplateConfiguration
directly, or another TemplateConfigurationFactory
's result, when
the specified matcher matches the template source.- Since:
- 2.3.24
-
Constructor Summary
ConstructorDescriptionConditionalTemplateConfigurationFactory(TemplateSourceMatcher matcher, TemplateConfigurationFactory templateConfigurationFactory)
ConditionalTemplateConfigurationFactory(TemplateSourceMatcher matcher, TemplateConfiguration templateConfiguration)
-
Method Summary
Modifier and TypeMethodDescriptionReturns (maybe creates) theTemplateConfiguration
for the given template source.protected void
CallsTemplateConfiguration.setParentConfiguration(Configuration)
on each enclosedTemplateConfiguration
andTemplateConfigurationFactory.setConfiguration(Configuration)
on each enclosedTemplateConfigurationFactory
objects.Methods inherited from class freemarker.cache.TemplateConfigurationFactory
getConfiguration, setConfiguration
-
Constructor Details
-
ConditionalTemplateConfigurationFactory
public ConditionalTemplateConfigurationFactory(TemplateSourceMatcher matcher, TemplateConfigurationFactory templateConfigurationFactory) -
ConditionalTemplateConfigurationFactory
public ConditionalTemplateConfigurationFactory(TemplateSourceMatcher matcher, TemplateConfiguration templateConfiguration)
-
-
Method Details
-
get
public TemplateConfiguration get(String sourceName, Object templateSource) throws IOException, TemplateConfigurationFactoryExceptionDescription copied from class:TemplateConfigurationFactory
Returns (maybe creates) theTemplateConfiguration
for the given template source.- Specified by:
get
in classTemplateConfigurationFactory
- 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.
-
setConfigurationOfChildren
Description copied from class:TemplateConfigurationFactory
CallsTemplateConfiguration.setParentConfiguration(Configuration)
on each enclosedTemplateConfiguration
andTemplateConfigurationFactory.setConfiguration(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.- Specified by:
setConfigurationOfChildren
in classTemplateConfigurationFactory
-