public class DefaultMustacheFactory extends Object implements MustacheFactory
| Modifier and Type | Class and Description |
|---|---|
protected class |
DefaultMustacheFactory.FragmentCacheLoader |
protected class |
DefaultMustacheFactory.MustacheCacheLoader |
| Modifier and Type | Field and Description |
|---|---|
protected com.google.common.util.concurrent.ListeningExecutorService |
les |
protected MustacheParser |
mc
This parser should work with any MustacheFactory
|
protected com.google.common.cache.LoadingCache<String,Mustache> |
mustacheCache
Create the default cache for mustache compilations.
|
protected ObjectHandler |
oh
This is the default object handler.
|
protected int |
recursionLimit |
protected com.google.common.cache.LoadingCache<FragmentKey,Mustache> |
templateCache
New templates that are generated at runtime are cached here.
|
| Constructor and Description |
|---|
DefaultMustacheFactory() |
DefaultMustacheFactory(File fileRoot)
Use the file system to resolve mustache templates.
|
DefaultMustacheFactory(String resourceRoot)
Use the classpath to resolve mustache templates.
|
| Modifier and Type | Method and Description |
|---|---|
Mustache |
compile(Reader reader,
String name)
Create a mustache given a reader and a name.
|
Mustache |
compile(Reader reader,
String file,
String sm,
String em) |
Mustache |
compile(String name)
Create a mustache given a resource name.
|
protected com.google.common.cache.LoadingCache<FragmentKey,Mustache> |
createLambdaCache() |
protected com.google.common.cache.LoadingCache<String,Mustache> |
createMustacheCache() |
MustacheVisitor |
createMustacheVisitor()
Creates the visitor for compilation.
|
void |
encode(String value,
Writer writer)
This defines how "encoded" values are encoded.
|
String |
filterText(String appended,
boolean b)
Override this method to apply any filtering to text that will appear
verbatim in the output template.
|
ExecutorService |
getExecutorService()
There is an ExecutorService that is used when executing parallel
operations when a Callable is returned from a mustache value or iterable.
|
Mustache |
getFragment(FragmentKey templateKey) |
ObjectHandler |
getObjectHandler()
The object handler knows how to transform names into fields and methods.
|
Reader |
getReader(String resourceName)
Given a resource name, construct a reader.
|
int |
getRecursionLimit() |
void |
setExecutorService(ExecutorService es)
If you need to specify your own executor service you can.
|
void |
setObjectHandler(ObjectHandler oh)
You can override the default object handler post construction.
|
void |
setRecursionLimit(int recursionLimit)
Maximum recursion limit for partials.
|
String |
translate(String from)
Converts your arbitrary name to another name.
|
protected final com.google.common.cache.LoadingCache<String,Mustache> mustacheCache
protected ObjectHandler oh
protected final MustacheParser mc
protected final com.google.common.cache.LoadingCache<FragmentKey,Mustache> templateCache
protected int recursionLimit
protected com.google.common.util.concurrent.ListeningExecutorService les
public DefaultMustacheFactory()
public DefaultMustacheFactory(String resourceRoot)
resourceRoot - public DefaultMustacheFactory(File fileRoot)
fileRoot - public MustacheVisitor createMustacheVisitor()
MustacheFactorycreateMustacheVisitor in interface MustacheFactorypublic Reader getReader(String resourceName)
MustacheFactorygetReader in interface MustacheFactoryresourceName - used to find the resourcepublic void encode(String value, Writer writer)
MustacheFactoryencode in interface MustacheFactoryvalue - the unencoded valuewriter - where to encode the valuepublic ObjectHandler getObjectHandler()
MustacheFactorygetObjectHandler in interface MustacheFactorypublic void setObjectHandler(ObjectHandler oh)
oh - public ExecutorService getExecutorService()
public void setExecutorService(ExecutorService es)
es - public Mustache getFragment(FragmentKey templateKey)
public Mustache compile(String name)
MustacheFactorycompile in interface MustacheFactoryname - the name of the resourcepublic Mustache compile(Reader reader, String name)
MustacheFactorycompile in interface MustacheFactoryreader - the readername - the name of the resourcepublic String translate(String from)
MustacheFactorytranslate in interface MustacheFactoryfrom - the tag to replacepublic String filterText(String appended, boolean b)
appended - b - public void setRecursionLimit(int recursionLimit)
public int getRecursionLimit()
protected com.google.common.cache.LoadingCache<String,Mustache> createMustacheCache()
protected com.google.common.cache.LoadingCache<FragmentKey,Mustache> createLambdaCache()
Copyright © 2013. All Rights Reserved.