Fork me on GitHub

EvaluationContextImpl

In package com.mitchellbosecke.pebble.template

public class EvaluationContextImpl extends Object implements EvaluationContext, RenderedSizeContext

An evaluation context will store all stateful data that is necessary for the evaluation of a template. Passing the entire state around will assist with thread safety.

Constructors

public EvaluationContextImpl(PebbleTemplateImpl self, boolean strictVariables, Locale locale, int maxRenderedSize, ExtensionRegistry extensionRegistry, PebbleCache<CacheKey, Object> tagCache, ExecutorService executorService, List<PebbleTemplateImpl> importedTemplates, Map<String, PebbleTemplateImpl> namedImportedTemplates, ScopeChain scopeChain, Hierarchy hierarchy, EvaluationOptions evaluationOptions)

Constructor used to provide all final variables.

Parameters:

Methods

public EvaluationContextImpl shallowCopyWithoutInheritanceChain(PebbleTemplateImpl self)

Makes an exact copy of the evaluation context EXCEPT for the inheritance chain. This is necessary for the "include" tag.

Parameters:
public EvaluationContextImpl threadSafeCopy(PebbleTemplateImpl self)

Makes a "snapshot" of the evaluation context. The scopeChain object will be a deep copy and the imported templates will be a new list. This is used for the "parallel" tag.

Parameters:
public PebbleTemplateImpl getNamedImportedTemplate(String alias)

Returns the named imported template.

Parameters:
  • String alias
public void addNamedImportedTemplates(String alias, PebbleTemplateImpl template)
Parameters:
public boolean isStrictVariables()

Returns whether or not this template is being evaluated in "strict templates" mode

Parameters:
  • No parameters
public Locale getLocale()

Returns the locale

Parameters:
  • No parameters
public int getMaxRenderedSize()

Returns the max rendered size.

Parameters:
  • No parameters
public ExtensionRegistry getExtensionRegistry()

Returns the extension registry used to access all of the tests/filters/functions

Parameters:
  • No parameters
public ExecutorService getExecutorService()

Returns the executor service if exists or null

Parameters:
  • No parameters
public List<PebbleTemplateImpl> getImportedTemplates()

Returns a list of imported templates.

Parameters:
  • No parameters
public PebbleCache<CacheKey, Object> getTagCache()

Returns the cache used for the "cache" tag

Parameters:
  • No parameters
public ScopeChain getScopeChain()

Returns the scope chain data structure that allows variables to be added/removed from the current scope and retrieved from the nearest visible scopes.

Parameters:
  • No parameters
public Hierarchy getHierarchy()

Returns the data structure representing the entire hierarchy of the template currently being evaluated.

Parameters:
  • No parameters
public EvaluationOptions getEvaluationOptions()

Returns the evaluation options.

Parameters:
  • No parameters
public Object getVariable(String key)
Parameters:
  • String key
public void scopedShallowWithoutInheritanceChain(PebbleTemplateImpl template, Map<?, ?> additionalVariables, PebbleConsumer<EvaluationContextImpl> scopedFunction)
Parameters:
public int addAndGet(int delta)
Parameters:
  • int delta