java.lang.Object
net.entframework.kernel.db.generator.plugin.web.freemarker.ProxyTemplateLoader
所有已实现的接口:
freemarker.cache.StatefulTemplateLoader, freemarker.cache.TemplateLoader

public class ProxyTemplateLoader extends Object implements freemarker.cache.StatefulTemplateLoader
A TemplateLoader that uses a set of other loaders to load the templates. On every request, loaders are queried in the order of their appearance in the array of loaders provided to the constructor. However, by default, if a request for some template name was already satisfied in the past by one of the loaders, that loader is queried first (stickiness). This behavior can be disabled with setSticky(boolean), then the loaders are always queried in the order of their appearance in the array.

This class is thread-safe.

  • 构造器详细资料

    • ProxyTemplateLoader

      public ProxyTemplateLoader(freemarker.cache.TemplateLoader[] templateLoaders)
      Creates a new instance that will use the specified template loaders.
      参数:
      templateLoaders - the template loaders that are used to load templates, in the order as they will be searched (except where stickiness says otherwise).
  • 方法详细资料

    • findTemplateSource

      public Object findTemplateSource(String name) throws IOException
      指定者:
      findTemplateSource 在接口中 freemarker.cache.TemplateLoader
      抛出:
      IOException
    • getLastModified

      public long getLastModified(Object templateSource)
      指定者:
      getLastModified 在接口中 freemarker.cache.TemplateLoader
    • getReader

      public Reader getReader(Object templateSource, String encoding) throws IOException
      指定者:
      getReader 在接口中 freemarker.cache.TemplateLoader
      抛出:
      IOException
    • closeTemplateSource

      public void closeTemplateSource(Object templateSource) throws IOException
      指定者:
      closeTemplateSource 在接口中 freemarker.cache.TemplateLoader
      抛出:
      IOException
    • resetState

      public void resetState()
      Clears the sickiness memory, also resets the state of all enclosed StatefulTemplateLoader-s.
      指定者:
      resetState 在接口中 freemarker.cache.StatefulTemplateLoader
    • toString

      public String toString()
      Show class name and some details that are useful in template-not-found errors.
      覆盖:
      toString 在类中 Object
      从以下版本开始:
      2.3.21
    • getTemplateLoaderCount

      public int getTemplateLoaderCount()
      Returns the number of TemplateLoader-s directly inside this TemplateLoader.
      从以下版本开始:
      2.3.23
    • getTemplateLoader

      public freemarker.cache.TemplateLoader getTemplateLoader(int index)
      Returns the TemplateLoader at the given index.
      参数:
      index - Must be below getTemplateLoaderCount().
    • isSticky

      public boolean isSticky()
      Getter pair of setSticky(boolean).
      从以下版本开始:
      2.3.24
    • setSticky

      public void setSticky(boolean sticky)
      Sets if for a name that was already loaded earlier the same TemplateLoader will be tried first, or we always try the TemplateLoader-s strictly in the order as it was specified in the constructor. The default is true.
      从以下版本开始:
      2.3.24