Package freemarker.cache
Class ConditionalTemplateConfigurationFactory
- java.lang.Object
-
- freemarker.cache.TemplateConfigurationFactory
-
- freemarker.cache.ConditionalTemplateConfigurationFactory
-
public class ConditionalTemplateConfigurationFactory extends TemplateConfigurationFactory
Returns the givenTemplateConfigurationdirectly, or anotherTemplateConfigurationFactory's result, when the specified matcher matches the template source.- Since:
- 2.3.24
-
-
Constructor Summary
Constructors Constructor Description ConditionalTemplateConfigurationFactory(TemplateSourceMatcher matcher, TemplateConfigurationFactory templateConfigurationFactory)ConditionalTemplateConfigurationFactory(TemplateSourceMatcher matcher, TemplateConfiguration templateConfiguration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TemplateConfigurationget(java.lang.String sourceName, java.lang.Object templateSource)Returns (maybe creates) theTemplateConfigurationfor the given template source.protected voidsetConfigurationOfChildren(Configuration cfg)CallsTemplateConfiguration.setParentConfiguration(Configuration)on each enclosedTemplateConfigurationandTemplateConfigurationFactory.setConfiguration(Configuration)on each enclosedTemplateConfigurationFactoryobjects.-
Methods inherited from class freemarker.cache.TemplateConfigurationFactory
getConfiguration, setConfiguration
-
-
-
-
Constructor Detail
-
ConditionalTemplateConfigurationFactory
public ConditionalTemplateConfigurationFactory(TemplateSourceMatcher matcher, TemplateConfigurationFactory templateConfigurationFactory)
-
ConditionalTemplateConfigurationFactory
public ConditionalTemplateConfigurationFactory(TemplateSourceMatcher matcher, TemplateConfiguration templateConfiguration)
-
-
Method Detail
-
get
public TemplateConfiguration get(java.lang.String sourceName, java.lang.Object templateSource) throws java.io.IOException, TemplateConfigurationFactoryException
Description copied from class:TemplateConfigurationFactoryReturns (maybe creates) theTemplateConfigurationfor the given template source.- Specified by:
getin 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
TemplateConfigurationto apply, ornullif the there's noTemplateConfigurationfor 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.
-
setConfigurationOfChildren
protected void setConfigurationOfChildren(Configuration cfg)
Description copied from class:TemplateConfigurationFactoryCallsTemplateConfiguration.setParentConfiguration(Configuration)on each enclosedTemplateConfigurationandTemplateConfigurationFactory.setConfiguration(Configuration)on each enclosedTemplateConfigurationFactoryobjects. It only supposed to call these on the direct "children" of this object, not on the children of the children.- Specified by:
setConfigurationOfChildrenin classTemplateConfigurationFactory
-
-