public static class PebbleEngine.Builder extends Object
Constructor and Description |
---|
Builder()
Creates the builder.
|
Modifier and Type | Method and Description |
---|---|
PebbleEngine.Builder |
addEscapingStrategy(String name,
EscapingStrategy strategy)
Adds an escaping strategy to the built-in escaper extension.
|
PebbleEngine.Builder |
allowGetClass(boolean allowGetClass)
Enable/disable getClass access for attributes
|
PebbleEngine.Builder |
autoEscaping(boolean autoEscaping)
Sets whether or not escaping should be performed automatically.
|
PebbleEngine |
build()
Creates the PebbleEngine instance.
|
PebbleEngine.Builder |
cacheActive(boolean cacheActive)
Enable/disable all caches, i.e.
|
PebbleEngine.Builder |
defaultEscapingStrategy(String strategy)
Sets the default escaping strategy of the built-in escaper extension.
|
PebbleEngine.Builder |
defaultLocale(Locale defaultLocale)
Sets the Locale passed to all templates constructed by this PebbleEngine.
|
PebbleEngine.Builder |
executorService(ExecutorService executorService)
Sets the executor service which is required if using one of Pebble's multithreading features
such as the "parallel" tag.
|
PebbleEngine.Builder |
extension(Extension... extensions)
Adds an extension, can be safely invoked several times to add different extensions.
|
PebbleEngine.Builder |
greedyMatchMethod(boolean greedyMatchMethod)
Enable/disable greedy matching mode for finding java method.
|
PebbleEngine.Builder |
literalDecimalTreatedAsInteger(boolean literalDecimalTreatedAsInteger)
Enable/disable treat literal decimal as Integer.
|
PebbleEngine.Builder |
loader(Loader<?> loader)
Sets the loader used to find templates.
|
PebbleEngine.Builder |
newLineTrimming(boolean enableNewLineTrimming)
Changes the
newLineTrimming setting of the PebbleEngine. |
PebbleEngine.Builder |
strictVariables(boolean strictVariables)
Changes the
strictVariables setting of the PebbleEngine. |
PebbleEngine.Builder |
syntax(Syntax syntax)
Sets the syntax to be used.
|
PebbleEngine.Builder |
tagCache(PebbleCache<CacheKey,Object> tagCache)
Sets the cache used by the "cache" tag.
|
PebbleEngine.Builder |
templateCache(PebbleCache<Object,PebbleTemplate> templateCache)
Sets the cache used by the engine to store compiled PebbleTemplate instances.
|
public PebbleEngine.Builder loader(Loader<?> loader)
loader
- A template loaderpublic PebbleEngine.Builder extension(Extension... extensions)
extensions
- One or more extensions to addpublic PebbleEngine.Builder syntax(Syntax syntax)
syntax
- The syntax to be usedpublic PebbleEngine.Builder strictVariables(boolean strictVariables)
strictVariables
setting of the PebbleEngine. The default value of
this setting is "false".
The following examples will all print empty strings if strictVariables is false but will throw exceptions if it is true:
{{ nonExistingVariable }} {{ nonExistingVariable.attribute }} {{ nullVariable.attribute }} {{ existingVariable.nullAttribute.attribute }} {{ existingVariable.nonExistingAttribute }} {{ array[-1] }}strictVariables
- Whether or not strict variables is usedpublic PebbleEngine.Builder newLineTrimming(boolean enableNewLineTrimming)
newLineTrimming
setting of the PebbleEngine. The default value of
this setting is "true".
By default, Pebble will trim a newline that immediately follows a Pebble tag. For example,
{{key1}}\n{{key2}}
will have the newline removed.
If newLineTrimming
is set to false, then the first newline following a Pebble
tag won't be trimmed. All newlines will be preserved
enableNewLineTrimming
- Whether or not the newline should be trimmed.public PebbleEngine.Builder defaultLocale(Locale defaultLocale)
An individual template can always be given a new locale during evaluation.
defaultLocale
- The default localepublic PebbleEngine.Builder executorService(ExecutorService executorService)
executorService
- The executor servicepublic PebbleEngine.Builder templateCache(PebbleCache<Object,PebbleTemplate> templateCache)
templateCache
- The template cachepublic PebbleEngine.Builder tagCache(PebbleCache<CacheKey,Object> tagCache)
tagCache
- The tag cachepublic PebbleEngine.Builder autoEscaping(boolean autoEscaping)
autoEscaping
- The auto escaping settingpublic PebbleEngine.Builder defaultEscapingStrategy(String strategy)
strategy
- The name of the default escaping strategypublic PebbleEngine.Builder addEscapingStrategy(String name, EscapingStrategy strategy)
name
- The name of the escaping strategystrategy
- The strategy implementationpublic PebbleEngine.Builder cacheActive(boolean cacheActive)
cacheActive
- toggle to enable/disable all cachespublic PebbleEngine.Builder allowGetClass(boolean allowGetClass)
allowGetClass
- toggle to enable/disable getClass accesspublic PebbleEngine.Builder literalDecimalTreatedAsInteger(boolean literalDecimalTreatedAsInteger)
literalDecimalTreatedAsInteger
- toggle to enable/disable literal decimal treated as
integerpublic PebbleEngine.Builder greedyMatchMethod(boolean greedyMatchMethod)
{{ obj.number(2) }}the expression can match all of below methods.
public Long getNumber(Long v) {...} public Integer getNumber(Integer v) {...} public Short getNumber(Short v) {...} public Byte getNumber(Byte v) {...} ...
greedyMatchMethod
- toggle to enable/disable greedy match methodTypeUtils.compatibleCast(Object, Class)
public PebbleEngine build()
Copyright © 2018. All rights reserved.