Package freemarker.core
Class AbstractScope
- java.lang.Object
-
- freemarker.core.AbstractScope
-
- All Implemented Interfaces:
Scope,TemplateHashModel,TemplateHashModelEx,TemplateModel
- Direct Known Subclasses:
BaseScope
public abstract class AbstractScope extends Object implements Scope
An abstract scope with no variable storage mechanism of its own; only provides enclosing scope and operations related to enclosing scope.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface freemarker.template.TemplateModel
TemplateModel.InvalidExpressionModel, TemplateModel.JavaNull
-
-
Field Summary
-
Fields inherited from interface freemarker.template.TemplateModel
INVALID_EXPRESSION, JAVA_NULL, NOTHING
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractScope(Scope enclosingScope)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ScopegetEnclosingScope()EnvironmentgetEnvironment()Returns the Environment of the enclosing scopeTemplategetTemplate()Returns the template of the enclosing scopebooleanisEmpty()TemplateModelresolveVariable(String key)Evaluates the variable of this name in this scope, falling back to the enclosing Scope if it is not defined in this one.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface freemarker.core.Scope
definesVariable, getDirectVariableNames, put, remove
-
Methods inherited from interface freemarker.template.TemplateHashModel
get
-
Methods inherited from interface freemarker.template.TemplateHashModelEx
keys, size, values
-
-
-
-
Constructor Detail
-
AbstractScope
protected AbstractScope(Scope enclosingScope)
-
-
Method Detail
-
getEnclosingScope
public final Scope getEnclosingScope()
- Specified by:
getEnclosingScopein interfaceScope- Returns:
- the fallback Scope for variable resolution
-
getTemplate
public Template getTemplate()
Returns the template of the enclosing scope- Specified by:
getTemplatein interfaceScope- Returns:
- the template of the enclosing scope
-
getEnvironment
public Environment getEnvironment()
Returns the Environment of the enclosing scope- Specified by:
getEnvironmentin interfaceScope- Returns:
- the Environment of the enclosing scope
-
resolveVariable
public final TemplateModel resolveVariable(String key) throws TemplateModelException
Description copied from interface:ScopeEvaluates the variable of this name in this scope, falling back to the enclosing Scope if it is not defined in this one.- Specified by:
resolveVariablein interfaceScope- Throws:
TemplateModelException
-
isEmpty
public boolean isEmpty() throws TemplateModelException- Specified by:
isEmptyin interfaceTemplateHashModel- Throws:
TemplateModelException
-
-