ConditionalTemplateConfigurationFactory (FreeMarker 2.3.35 API)
Description: declaration: package: freemarker.cache, class: ConditionalTemplateConfigurationFactory

Package freemarker.cache

# Class ConditionalTemplateConfigurationFactory

java.lang.Object
freemarker.cache.TemplateConfigurationFactory
freemarker.cache.ConditionalTemplateConfigurationFactory

public class ConditionalTemplateConfigurationFactory extends TemplateConfigurationFactory
Returns the given `TemplateConfiguration` directly, or another `TemplateConfigurationFactory`'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

  Modifier and Type
  Method
  Description
  `TemplateConfiguration`
  `get​(String sourceName, Object templateSource)`
  Returns (maybe creates) the `TemplateConfiguration` for the given template source.
  `protected void`
  `setConfigurationOfChildren​(Configuration cfg)`
  Calls `TemplateConfiguration.setParentConfiguration(Configuration)` on each enclosed `TemplateConfiguration` and `TemplateConfigurationFactory.setConfiguration(Configuration)` on each enclosed `TemplateConfigurationFactory` objects.

  ### Methods inherited from class freemarker.cache.TemplateConfigurationFactory

  `getConfiguration, setConfiguration`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## 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, TemplateConfigurationFactoryException
    Description copied from class: `TemplateConfigurationFactory`
    Returns (maybe creates) the `TemplateConfiguration` for the given template source.
    Specified by:
      `get` in class `TemplateConfigurationFactory`
    Parameters:
      `sourceName` - The name (path) that was used for `TemplateLoader.findTemplateSource(String)`. See `Template.getSourceName()` for details.
      `templateSource` - The object returned by `TemplateLoader.findTemplateSource(String)`.
    Returns:
      The `TemplateConfiguration` to apply, or `null` if the there's no `TemplateConfiguration` for this template source.
    Throws:
      `IOException` - Typically, if the 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: `TemplateConfigurationFactory`
    Calls `TemplateConfiguration.setParentConfiguration(Configuration)` on each enclosed `TemplateConfiguration` and `TemplateConfigurationFactory.setConfiguration(Configuration)` on each enclosed `TemplateConfigurationFactory` 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 class `TemplateConfigurationFactory`