Package com.github.mustachejava
Class FallbackMustacheFactory
java.lang.Object
com.github.mustachejava.DefaultMustacheFactory
com.github.mustachejava.FallbackMustacheFactory
- All Implemented Interfaces:
MustacheFactory
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
FieldsModifier and TypeFieldDescriptionprivate Object[]List of fallback resource roots to search through.Fields inherited from class com.github.mustachejava.DefaultMustacheFactory
es, mc, mustacheCache, oh, recursionLimit, templateCache -
Constructor Summary
ConstructorsConstructorDescriptionFallbackMustacheFactory(File fileRoot, File fallbackRoot) Simple constructor for a fallback Mustache.java factory.FallbackMustacheFactory(Object... resourceRoots) Generic constructor for a fallback Mustache.java factory.FallbackMustacheFactory(String resourceRoot, String fallbackRoot) Simple constructor for a fallback Mustache.java factory. -
Method Summary
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
-
Field Details
-
resourceRoots
List of fallback resource roots to search through.
-
-
Constructor Details
-
FallbackMustacheFactory
Simple constructor for a fallback Mustache.java factory.- Parameters:
resourceRoot- normal resource rootfallbackRoot- fallback alternative root
-
FallbackMustacheFactory
Simple constructor for a fallback Mustache.java factory.- Parameters:
fileRoot- normal resource rootfallbackRoot- fallback alternative root
-
FallbackMustacheFactory
Generic constructor for a fallback Mustache.java factory.- Parameters:
resourceRoots- array of fallback resource roots as String or File
-
-
Method Details
-
getReader
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
-