Class Scope
- java.lang.Object
 - 
- java.util.AbstractMap<Object,Object>
 - 
- org.apache.velocity.runtime.directive.Scope
 
 
 
- 
- Direct Known Subclasses:
 ForeachScope
public class Scope extends AbstractMap<Object,Object>
This handles context scoping and metadata for directives.- Version:
 - $Id$
 - Author:
 - Nathan Bubna
 
 
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Class Description static classScope.InfoClass to encapsulate and provide access to info about the current scope for debugging.- 
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object> 
 - 
 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<Map.Entry<Object,Object>>entrySet()Objectget(Object key)getterprotected intgetDepth()Returns the number of control arguments of this type that are stacked up.Scope.InfogetInfo()Returns info about the current scope for debugging purposes.ScopegetParent()Returns the parent control reference overridden by the placement of this instance in the context.ObjectgetReplaced()Returns the user's context reference overridden by the placement of this instance in the context.ScopegetTopmost()Returns the topmost parent control reference, retrieved by simple recursion ongetParent().Objectput(Object key, Object value)setterStringset(Object key, Object value)Convenience method to call put(key,val) in a template without worrying about what is returned/rendered by the call.protected voidstop()Allows #stop to easily trigger the proper StopCommand for this scope.- 
Methods inherited from class java.util.AbstractMap
clear, clone, containsKey, containsValue, equals, hashCode, isEmpty, keySet, putAll, remove, size, toString, values 
- 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait 
- 
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll 
 - 
 
 - 
 
- 
- 
Field Detail
- 
owner
protected final Object owner
 
 - 
 
- 
Method Detail
- 
set
public String set(Object key, Object value)
Convenience method to call put(key,val) in a template without worrying about what is returned/rendered by the call. This should ALWAYS return an empty string.- Parameters:
 key-value-- Returns:
 - empty string
 
 
- 
stop
protected void stop()
Allows #stop to easily trigger the proper StopCommand for this scope. 
- 
getDepth
protected int getDepth()
Returns the number of control arguments of this type that are stacked up. This is the distance between this instance and the topmost instance, plus one. This value will never be negative or zero.- Returns:
 - depth
 
 
- 
getTopmost
public Scope getTopmost()
Returns the topmost parent control reference, retrieved by simple recursion ongetParent().- Returns:
 - top-most scope
 
 
- 
getParent
public Scope getParent()
Returns the parent control reference overridden by the placement of this instance in the context.- Returns:
 - parent scope
 
 
- 
getReplaced
public Object getReplaced()
Returns the user's context reference overridden by the placement of this instance in the context. If there was none (as is hoped), then this will return null. This never returns parent controls; those are returned bygetParent().- Returns:
 - replaced reference value, or null
 
 
- 
getInfo
public Scope.Info getInfo()
Returns info about the current scope for debugging purposes.- Returns:
 - template debugging infos
 
 
 - 
 
 -