Package org.apache.velocity.context
Class EvaluateContext
- java.lang.Object
-
- org.apache.velocity.context.ChainedInternalContextAdapter
-
- org.apache.velocity.context.EvaluateContext
-
- All Implemented Interfaces:
Context
,InternalContextAdapter
,InternalEventContext
,InternalHousekeepingContext
,InternalWrapperContext
public class EvaluateContext extends ChainedInternalContextAdapter
Deprecated.Will be removed in 2.0This is a special, internal-use-only context implementation to be used for the #evaluate directive. We use this context to chain the existing context, preventing any changes from impacting the parent context. By separating this context into a separate class it also allows for the future possibility of changing the context behavior for the #evaluate directive. Note that the context used to store values local to #evaluate() is user defined but defaults toVelocityContext
.- Since:
- 1.6
- Version:
- $Id: EvaluateContext.java 898032 2010-01-11 19:51:03Z nbubna $
-
-
Field Summary
Fields Modifier and Type Field Description (package private) Context
localContext
Deprecated.container for any local items-
Fields inherited from class org.apache.velocity.context.ChainedInternalContextAdapter
innerContext
-
-
Constructor Summary
Constructors Constructor Description EvaluateContext(InternalContextAdapter inner, RuntimeServices rsvc)
Deprecated.CTOR, wraps an ICA
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
containsKey(java.lang.Object key)
Deprecated.Indicates whether the specified key is in the context.java.lang.Object
get(java.lang.String key)
Deprecated.Retrieves from local or global context.java.lang.Object[]
getKeys()
Deprecated.Get all the keys for the values in the context.private void
initContext(RuntimeServices rsvc)
Deprecated.Initialize the context based on user-configured classjava.lang.Object
localPut(java.lang.String key, java.lang.Object value)
Deprecated.Allows callers to explicitly put objects in the local context.java.lang.Object
put(java.lang.String key, java.lang.Object value)
Deprecated.Put method also stores values in local scopejava.lang.Object
remove(java.lang.Object key)
Deprecated.Removes the value associated with the specified key from the context.-
Methods inherited from class org.apache.velocity.context.ChainedInternalContextAdapter
attachEventCartridge, getBaseContext, getCurrentMacroCallDepth, getCurrentMacroName, getCurrentResource, getCurrentTemplateName, getEventCartridge, getInternalUserContext, getMacroLibraries, getMacroNameStack, getTemplateNameStack, icacheGet, icachePut, popCurrentMacroName, popCurrentTemplateName, pushCurrentMacroName, pushCurrentTemplateName, setCurrentResource, setMacroLibraries
-
-
-
-
Field Detail
-
localContext
Context localContext
Deprecated.container for any local items
-
-
Constructor Detail
-
EvaluateContext
public EvaluateContext(InternalContextAdapter inner, RuntimeServices rsvc)
Deprecated.CTOR, wraps an ICA- Parameters:
inner
- context for parent templatersvc
-
-
-
Method Detail
-
initContext
private void initContext(RuntimeServices rsvc)
Deprecated.Initialize the context based on user-configured class- Parameters:
rsvc
-
-
put
public java.lang.Object put(java.lang.String key, java.lang.Object value)
Deprecated.Put method also stores values in local scope- Specified by:
put
in interfaceContext
- Overrides:
put
in classChainedInternalContextAdapter
- Parameters:
key
- name of item to setvalue
- object to set to key- Returns:
- old stored object
-
get
public java.lang.Object get(java.lang.String key)
Deprecated.Retrieves from local or global context.- Specified by:
get
in interfaceContext
- Overrides:
get
in classChainedInternalContextAdapter
- Parameters:
key
- name of item to get- Returns:
- stored object or null
-
containsKey
public boolean containsKey(java.lang.Object key)
Deprecated.Description copied from interface:Context
Indicates whether the specified key is in the context.- Specified by:
containsKey
in interfaceContext
- Overrides:
containsKey
in classChainedInternalContextAdapter
- Parameters:
key
- The key to look for.- Returns:
- Whether the key is in the context.
- See Also:
Context.containsKey(java.lang.Object)
-
getKeys
public java.lang.Object[] getKeys()
Deprecated.Description copied from interface:Context
Get all the keys for the values in the context.- Specified by:
getKeys
in interfaceContext
- Overrides:
getKeys
in classChainedInternalContextAdapter
- Returns:
- All the keys for the values in the context.
- See Also:
Context.getKeys()
-
remove
public java.lang.Object remove(java.lang.Object key)
Deprecated.Description copied from interface:Context
Removes the value associated with the specified key from the context.- Specified by:
remove
in interfaceContext
- Overrides:
remove
in classChainedInternalContextAdapter
- Parameters:
key
- The name of the value to remove.- Returns:
- The value that the key was mapped to, or
null
if unmapped. - See Also:
Context.remove(java.lang.Object)
-
localPut
public java.lang.Object localPut(java.lang.String key, java.lang.Object value)
Deprecated.Allows callers to explicitly put objects in the local context. Objects added to the context through this method always end up in the top-level context of possible wrapped contexts.- Specified by:
localPut
in interfaceInternalWrapperContext
- Overrides:
localPut
in classChainedInternalContextAdapter
- Parameters:
key
- name of item to set.value
- object to set to key.- Returns:
- old stored object
- See Also:
InternalWrapperContext.localPut(java.lang.String,java.lang.Object)
-
-