Package freemarker.cache
Class TemplateConfigurationFactory
- java.lang.Object
-
- freemarker.cache.TemplateConfigurationFactory
-
- Direct Known Subclasses:
ConditionalTemplateConfigurationFactory,FirstMatchTemplateConfigurationFactory,MergingTemplateConfigurationFactory
public abstract class TemplateConfigurationFactory extends java.lang.ObjectCreates (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 TemplateConfigurationget(java.lang.String sourceName, java.lang.Object templateSource)Returns (maybe creates) theTemplateConfigurationfor the given template source.ConfigurationgetConfiguration()Returns the configuration this object belongs to, ornullif it isn't yet bound to aConfiguration.voidsetConfiguration(Configuration cfg)Binds thisTemplateConfigurationFactoryto aConfiguration.protected abstract voidsetConfigurationOfChildren(Configuration cfg)CallsTemplateConfiguration.setParentConfiguration(Configuration)on each enclosedTemplateConfigurationandsetConfiguration(Configuration)on each enclosedTemplateConfigurationFactoryobjects.
-
-
-
Method Detail
-
get
public abstract TemplateConfiguration get(java.lang.String sourceName, java.lang.Object templateSource) throws java.io.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:
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 thisTemplateConfigurationFactoryto aConfiguration. Once it's bound, it can't be bound to anotherConfigurationany more. This is automatically called byConfiguration.setTemplateConfigurations(TemplateConfigurationFactory).
-
getConfiguration
public Configuration getConfiguration()
Returns the configuration this object belongs to, ornullif it isn't yet bound to aConfiguration.
-
setConfigurationOfChildren
protected abstract void setConfigurationOfChildren(Configuration cfg)
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.
-
-