Package io.pebbletemplates.pebble
Class PebbleEngine
java.lang.Object
io.pebbletemplates.pebble.PebbleEngine
The main class used for compiling templates. The PebbleEngine is responsible for delegating
responsibility to the lexer, parser, compiler, and template cache.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
A builder to configure and construct an instance of a PebbleEngine. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Locale
private final EvaluationOptions
private final ExecutorService
private final ExtensionRegistry
private final Loader
<?> private final org.slf4j.Logger
private final int
private final ParserOptions
private final boolean
private final Syntax
private final PebbleCache
<CacheKey, Object> private final PebbleCache
<Object, PebbleTemplate> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
PebbleEngine
(Loader<?> loader, Syntax syntax, boolean strictVariables, Locale defaultLocale, int maxRenderedSize, PebbleCache<CacheKey, Object> tagCache, PebbleCache<Object, PebbleTemplate> templateCache, ExecutorService executorService, ExtensionRegistry extensionRegistry, ParserOptions parserOptions, EvaluationOptions evaluationOptions) Constructor for the Pebble Engine given an instantiated Loader. -
Method Summary
Modifier and TypeMethodDescriptionReturns the default localeReturns the executor serviceReturns the extension registry.getLiteralTemplate
(String templateName) Loads, parses, and compiles a template using a StringLoader into an instance of PebbleTemplate and returns this instance.Loader
<?> Returns the loaderint
Returns the max rendered size.private PebbleTemplate
getPebbleTemplate
(String templateName, Loader loader, Object cacheKey) Returns the syntax which is used by this PebbleEngine.Returns the tag cachegetTemplate
(String templateName) Loads, parses, and compiles a template into an instance of PebbleTemplate and returns this instance.private PebbleTemplate
getTemplate
(String templateName, Loader loader) Returns the template cacheboolean
Returns the strict variables setting
-
Field Details
-
logger
private final org.slf4j.Logger logger -
loader
-
syntax
-
strictVariables
private final boolean strictVariables -
defaultLocale
-
maxRenderedSize
private final int maxRenderedSize -
tagCache
-
executorService
-
templateCache
-
extensionRegistry
-
parserOptions
-
evaluationOptions
-
-
Constructor Details
-
PebbleEngine
private PebbleEngine(Loader<?> loader, Syntax syntax, boolean strictVariables, Locale defaultLocale, int maxRenderedSize, PebbleCache<CacheKey, Object> tagCache, PebbleCache<Object, PebbleTemplate> templateCache, ExecutorService executorService, ExtensionRegistry extensionRegistry, ParserOptions parserOptions, EvaluationOptions evaluationOptions) Constructor for the Pebble Engine given an instantiated Loader. This method does only load those userProvidedExtensions listed here.- Parameters:
loader
- The template loader for this enginesyntax
- the syntax to use for parsing the templates.
-
-
Method Details
-
getTemplate
Loads, parses, and compiles a template into an instance of PebbleTemplate and returns this instance.- Parameters:
templateName
- The name of the template- Returns:
- PebbleTemplate The compiled version of the template
-
getLiteralTemplate
Loads, parses, and compiles a template using a StringLoader into an instance of PebbleTemplate and returns this instance.- Parameters:
templateName
- The name of the template- Returns:
- PebbleTemplate The compiled version of the template
-
getTemplate
-
getPebbleTemplate
-
getLoader
Returns the loader- Returns:
- The loader
-
getTemplateCache
Returns the template cache- Returns:
- The template cache
-
isStrictVariables
public boolean isStrictVariables()Returns the strict variables setting- Returns:
- The strict variables setting
-
getDefaultLocale
Returns the default locale- Returns:
- The default locale
-
getMaxRenderedSize
public int getMaxRenderedSize()Returns the max rendered size.- Returns:
- The max rendered size.
-
getExecutorService
Returns the executor service- Returns:
- The executor service
-
getSyntax
Returns the syntax which is used by this PebbleEngine.- Returns:
- the syntax used by the PebbleEngine.
-
getExtensionRegistry
Returns the extension registry.- Returns:
- The extension registry
-
getTagCache
Returns the tag cache- Returns:
- The tag cache
-
getEvaluationOptions
-