public final class MustacheEngineBuilder extends Object implements ConfigurationExtension.ConfigurationExtensionBuilder
MustacheEngine
. It's not thread-safe. The builder is
considered immutable once the build()
method is called. Subsequent
invocations of any modifying method or build()
result in an
IllegalStateException
.
Note that most ConfigurationAware
components are tied to the specific
engine instance and cannot be reused as well.
Modifier and Type | Class and Description |
---|---|
static interface |
MustacheEngineBuilder.EngineBuiltCallback |
public MustacheEngine build()
public MustacheEngineBuilder addGlobalData(String name, Object value)
addGlobalData
in interface ConfigurationExtension.ConfigurationExtensionBuilder
value
- name
- public MustacheEngineBuilder addTemplateLocator(TemplateLocator locator)
locator
- public MustacheEngineBuilder addResolver(Resolver resolver)
addResolver
in interface ConfigurationExtension.ConfigurationExtensionBuilder
resolver
- public MustacheEngineBuilder setProperty(String key, Object value)
key
- value
- public <T extends ConfigurationKey> MustacheEngineBuilder setProperty(T configurationKey, Object value)
T
- The type of configuration keyconfigurationKey
- value
- public MustacheEngineBuilder setTextSupport(TextSupport textSupport)
textSupport
- public MustacheEngineBuilder setLocaleSupport(LocaleSupport localeSupport)
localeSupport
- public MustacheEngineBuilder registerCallback(MustacheEngineBuilder.EngineBuiltCallback callback)
callback
- public MustacheEngineBuilder addMustacheListener(MustacheListener listener)
Mustache
listener. Manually added listeners are always
registered before listeners added via configuration extensions.addMustacheListener
in interface ConfigurationExtension.ConfigurationExtensionBuilder
listener
- public MustacheEngineBuilder setKeySplitter(KeySplitter keySplitter)
keySplitter
- public MustacheEngineBuilder setMissingValueHandler(MissingValueHandler missingValueHandler)
missingValueHandler
- public MustacheEngineBuilder registerHelper(String name, Helper helper)
IllegalArgumentException
is thrown. Use registerHelper(String, Helper, boolean)
to
overwrite the helper.registerHelper
in interface ConfigurationExtension.ConfigurationExtensionBuilder
name
- helper
- ConfigurationExtensions#registerHelper(ConfigurationExtensionBuilder,
String, Helper)
public MustacheEngineBuilder registerHelper(String name, Helper helper, boolean overwrite)
overwrite
is
true
the previous instance is replaced, otherwise an
IllegalArgumentException
is thrown.registerHelper
in interface ConfigurationExtension.ConfigurationExtensionBuilder
name
- helper
- overwrite
- public MustacheEngineBuilder registerHelpers(Map<String,Helper> helpers)
IllegalArgumentException
is thrown. Use registerHelpers(Map, boolean)
to overwrite the
helpers.registerHelpers
in interface ConfigurationExtension.ConfigurationExtensionBuilder
helpers
- ConfigurationExtensions#registerHelpers(ConfigurationExtensionBuilder,
Map)
public MustacheEngineBuilder registerHelpers(Map<String,Helper> helpers, boolean overwrite)
overwrite
is
true
the previous instance is replaced, otherwise an
IllegalArgumentException
is thrown.registerHelpers
in interface ConfigurationExtension.ConfigurationExtensionBuilder
helpers
- overwrite
- public MustacheEngineBuilder omitServiceLoaderConfigurationExtensions()
ConfigurationExtension
public MustacheEngineBuilder setComputingCacheFactory(ComputingCacheFactory cacheFactory)
ComputingCacheFactory
.cacheFactory
- public MustacheEngineBuilder setIdentifierGenerator(IdentifierGenerator identifierGenerator)
IdentifierGenerator
.identifierGenerator
- public MustacheEngineBuilder setExecutorService(ExecutorService executorService)
ExecutorService
to be used for async tasks.executorService
- public MustacheEngineBuilder setLiteralSupport(LiteralSupport literalSupport)
LiteralSupport
.literalSupport
- public MustacheEngineBuilder setConfigurationExtensionClassLoader(ClassLoader configurationExtensionClassLoader)
ClassLoader
used to load ConfigurationExtension
s.configurationExtensionClassLoader
- public MustacheEngineBuilder addValueConverter(ValueConverter converter)
addValueConverter
in interface ConfigurationExtension.ConfigurationExtensionBuilder
converter
- public static MustacheEngineBuilder newBuilder()
public Set<TemplateLocator> buildTemplateLocators()
public TextSupport getTextSupport()
public LocaleSupport getLocaleSupport()
public boolean isOmitServiceLoaderConfigurationExtensions()
public List<MustacheListener> buildMustacheListeners()
public KeySplitter getKeySplitter()
public MissingValueHandler getMissingValueHandler()
public ComputingCacheFactory getComputingCacheFactory()
public IdentifierGenerator getIdentifierGenerator()
public ExecutorService getExecutorService()
public LiteralSupport getLiteralSupport()
public ClassLoader getConfigurationExtensionClassLoader()
public Set<ValueConverter> buildValueConverters()
Copyright © 2017. All rights reserved.