Top Description Inners Methods
com.google.escapevelocity

pack-priv Interface EvaluationContext

Known Direct Implementers
com.google.escapevelocity.EvaluationContext.PlainEvaluationContext, com.google.escapevelocity.Macro.MacroEvaluationContext
Imports
com.google.common.collect.ImmutableSet, java.lang.reflect.Method, java.util.Map, .TreeMap

The context of a template evaluation. This consists of the template variables and the template macros. The template variables start with the values supplied by the evaluation call, and can be changed by #set directives and during the execution of #foreach and macro calls. The macros start out with the ones that were defined in the root Template and may be supplemented by nested templates produced by #parse directives encountered in the root template or in nested templates.
Author
[email protected] (Éamonn McManus)

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Method Summary

Modifier and TypeMethod and Description
public Map<String, Macro>
getMacros()

Returns a modifiable mapping from macro names to macros.

public Object
public ImmutableSet<Method>
public Runnable

Returns:

a Runnable that will restore the variable to the value it had before. If the variable was undefined before this method was executed, the Runnable will make it undefined again. This allows us to restore the state of $x after #foreach ($x in ...).
setVar
(final String var, Object value)

Sets the given variable to the given value.

public boolean

Method Detail

getMacrosback to summary
public Map<String, Macro> getMacros()

Returns a modifiable mapping from macro names to macros. Initially this map starts off with the macros that were defined in the root template. As #parse directives are encountered in the evaluation, they may add further macros to the map.

getVarback to summary
public Object getVar(String var)
publicMethodsWithNameback to summary
public ImmutableSet<Method> publicMethodsWithName(Class<?> startClass, String name)

See MethodFinder#publicMethodsWithName.

setVarback to summary
public Runnable setVar(final String var, Object value)

Sets the given variable to the given value.

Returns:Runnable

a Runnable that will restore the variable to the value it had before. If the variable was undefined before this method was executed, the Runnable will make it undefined again. This allows us to restore the state of $x after #foreach ($x in ...).

varIsDefinedback to summary
public boolean varIsDefined(String var)
com.google.escapevelocity back to summary

public Class EvaluationContext.PlainEvaluationContext

extends Object
implements EvaluationContext
Class Inheritance
  • java.lang.Object
  • com.google.escapevelocity.EvaluationContext.PlainEvaluationContext
All Implemented Interfaces
com.google.escapevelocity.EvaluationContext

Field Summary

Modifier and TypeField and Description
private final Map<String, Macro>
private final MethodFinder
private final Map<String, Object>

Constructor Summary

AccessConstructor and Description
pack-priv
PlainEvaluationContext(Map<String, ?> vars, Map<String, Macro> macros, MethodFinder methodFinder)

Method Summary

Modifier and TypeMethod and Description
public Map<String, Macro>
getMacros()

Implements com.google.escapevelocity.EvaluationContext.getMacros.

Returns a modifiable mapping from macro names to macros.
public Object
public ImmutableSet<Method>
public Runnable
setVar(final String var, Object value)

Implements com.google.escapevelocity.EvaluationContext.setVar.

Sets the given variable to the given value.
public boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

macrosback to summary
private final Map<String, Macro> macros
methodFinderback to summary
private final MethodFinder methodFinder
varsback to summary
private final Map<String, Object> vars

Constructor Detail

PlainEvaluationContextback to summary
pack-priv PlainEvaluationContext(Map<String, ?> vars, Map<String, Macro> macros, MethodFinder methodFinder)

Method Detail

getMacrosback to summary
public Map<String, Macro> getMacros()

Implements com.google.escapevelocity.EvaluationContext.getMacros.

Doc from com.google.escapevelocity.EvaluationContext.getMacros.

Returns a modifiable mapping from macro names to macros. Initially this map starts off with the macros that were defined in the root template. As #parse directives are encountered in the evaluation, they may add further macros to the map.

Annotations
@Override
getVarback to summary
public Object getVar(String var)

Implements com.google.escapevelocity.EvaluationContext.getVar.

Annotations
@Override
publicMethodsWithNameback to summary
public ImmutableSet<Method> publicMethodsWithName(Class<?> startClass, String name)

Implements com.google.escapevelocity.EvaluationContext.publicMethodsWithName.

Doc from com.google.escapevelocity.EvaluationContext.publicMethodsWithName.

See MethodFinder#publicMethodsWithName.

Annotations
@Override
setVarback to summary
public Runnable setVar(final String var, Object value)

Implements com.google.escapevelocity.EvaluationContext.setVar.

Doc from com.google.escapevelocity.EvaluationContext.setVar.

Sets the given variable to the given value.

Returns:Runnable

a Runnable that will restore the variable to the value it had before. If the variable was undefined before this method was executed, the Runnable will make it undefined again. This allows us to restore the state of $x after #foreach ($x in ...).

Annotations
@Override
varIsDefinedback to summary
public boolean varIsDefined(String var)

Implements com.google.escapevelocity.EvaluationContext.varIsDefined.

Annotations
@Override