Package freemarker.core
Interface Scope
- All Superinterfaces:
TemplateHashModel,TemplateHashModelEx,TemplateModel
- All Known Implementing Classes:
AbstractScope,BaseScope,BlockScope,Configuration,Environment,IncludedTemplateNamespace,LoopContext,MacroContext,MacroInvocationBodyContext,TemplateNamespace
Represents a variable resolution context in FTL. This
may be the local variables in a macro, the context of a loop
or a template namespace
-
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 -
Method Summary
Modifier and TypeMethodDescriptionbooleandefinesVariable(String name) Returns the names of variables directly managed by this scope (i.e.voidput(String key, TemplateModel value) Set a variable in this scope.Removes a variable in this scope.resolveVariable(String name) 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 interface freemarker.template.TemplateHashModel
get, isEmptyMethods inherited from interface freemarker.template.TemplateHashModelEx
keys, size, values
-
Method Details
-
put
Set a variable in this scope. This will typically only be used internally by the FreeMarker engine. -
remove
Removes a variable in this scope. This will typically only be used by FreeMarker engine internals -
getEnvironment
Environment getEnvironment()- Returns:
- the Environment object associated with this Scope.
-
getTemplate
Template getTemplate()- Returns:
- the Template object associated with this Scope.
-
definesVariable
- Returns:
- whether the variable is defined in this specific scope. (It could be defined in a fallback scope and this method will return false.)
-
getEnclosingScope
Scope getEnclosingScope()- Returns:
- the fallback Scope for variable resolution
-
resolveVariable
Evaluates the variable of this name in this scope, falling back to the enclosing Scope if it is not defined in this one.- Throws:
TemplateModelException
-
getDirectVariableNames
Returns the names of variables directly managed by this scope (i.e. it does not traverse the chain of enclosing scopes, but limits itself to this scope only).- Returns:
- a collection of known variable names for this scope, without enclosing scopes. The returned collection should be either immutable, or it should be disconnected from the scope, so any modifications to the collection don't affect the scope.
- Throws:
TemplateModelException
-