Package com.github.mustachejava
Class FallbackMustacheFactory
- java.lang.Object
-
- com.github.mustachejava.DefaultMustacheFactory
-
- com.github.mustachejava.FallbackMustacheFactory
-
- All Implemented Interfaces:
MustacheFactory
public class FallbackMustacheFactory extends DefaultMustacheFactory
Mustache.java factory with a fallback mechanism for locating resources. (Some parts are based on DefaultMustacheFactory code that is Copyright 2010 RightTime, Inc.)
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Object[]resourceRootsList of fallback resource roots to search through.-
Fields inherited from class com.github.mustachejava.DefaultMustacheFactory
es, mc, mustacheCache, oh, recursionLimit, templateCache
-
-
Constructor Summary
Constructors Constructor Description FallbackMustacheFactory(java.io.File fileRoot, java.io.File fallbackRoot)Simple constructor for a fallback Mustache.java factory.FallbackMustacheFactory(java.lang.Object... resourceRoots)Generic constructor for a fallback Mustache.java factory.FallbackMustacheFactory(java.lang.String resourceRoot, java.lang.String fallbackRoot)Simple constructor for a fallback Mustache.java factory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.io.ReadergetReader(java.lang.String resourceName)Return a reader for accessing resource files.-
Methods inherited from class com.github.mustachejava.DefaultMustacheFactory
compile, compile, compile, compilePartial, createLambdaCache, createMustacheCache, createMustacheVisitor, createParser, encode, filterText, getExecutorService, getFragment, getFragmentCacheFunction, getMustacheCacheFunction, getObjectHandler, getRecursionLimit, resolvePartialPath, setExecutorService, setObjectHandler, setRecursionLimit, translate
-
-
-
-
Constructor Detail
-
FallbackMustacheFactory
public FallbackMustacheFactory(java.lang.String resourceRoot, java.lang.String fallbackRoot)Simple constructor for a fallback Mustache.java factory.- Parameters:
resourceRoot- normal resource rootfallbackRoot- fallback alternative root
-
FallbackMustacheFactory
public FallbackMustacheFactory(java.io.File fileRoot, java.io.File fallbackRoot)Simple constructor for a fallback Mustache.java factory.- Parameters:
fileRoot- normal resource rootfallbackRoot- fallback alternative root
-
FallbackMustacheFactory
public FallbackMustacheFactory(java.lang.Object... resourceRoots)
Generic constructor for a fallback Mustache.java factory.- Parameters:
resourceRoots- array of fallback resource roots as String or File
-
-
Method Detail
-
getReader
public java.io.Reader getReader(java.lang.String resourceName)
Return a reader for accessing resource files.- Specified by:
getReaderin interfaceMustacheFactory- Overrides:
getReaderin classDefaultMustacheFactory- Parameters:
resourceName- resource name relative to one of the fallback resource roots- Returns:
- resource file reader
-
-