Package org.apache.velocity.context
Class InternalContextAdapterImpl
java.lang.Object
org.apache.velocity.context.InternalContextAdapterImpl
- All Implemented Interfaces:
Context
,InternalContextAdapter
,InternalEventContext
,InternalWrapperContext
This adapter class is the container for all context types for internal
use. The AST now uses this class rather than the app-level Context
interface to allow flexibility in the future.
Currently, we have two context interfaces which must be supported :
- Context : used for application/template data access
- InternalHousekeepingContext : used for internal housekeeping and caching
- InternalWrapperContext : used for getting root cache context and other such.
- InternalEventContext : for event handling.
- Version:
- $Id: InternalContextAdapterImpl.java 731266 2009-01-04 15:11:20Z byron $
- Author:
- Geir Magnusson Jr.
-
Constructor Summary
ConstructorsConstructorDescriptionCTOR takes a Context and wraps it, delegating all 'data' calls to it. -
Method Summary
Modifier and TypeMethodDescriptionboolean
containsKey
(Object key) Indicates whether the specified key is in the context.Gets the value corresponding to the provided key from the context.Returns the base context that we are wrapping.int
returns the user data context that we are wrappingObject[]
getKeys()
Get all the keys for the values in the context.Object[]
Object[]
void
icachePut
(Object key, IntrospectionCacheData o) Allows callers to explicitly put objects in the local context.void
void
void
void
Adds a name/value pair to the context.Removes the value associated with the specified key from the context.void
void
setMacroLibraries
(List macroLibraries)
-
Constructor Details
-
InternalContextAdapterImpl
CTOR takes a Context and wraps it, delegating all 'data' calls to it. For support of internal contexts, it will create an InternalContextBase if need be.- Parameters:
c
-
-
-
Method Details
-
pushCurrentTemplateName
- See Also:
-
InternalHousekeepingContext.pushCurrentTemplateName(java.lang.String)
-
popCurrentTemplateName
public void popCurrentTemplateName()- See Also:
-
InternalHousekeepingContext.popCurrentTemplateName()
-
getCurrentTemplateName
- See Also:
-
InternalHousekeepingContext.getCurrentTemplateName()
-
getTemplateNameStack
- See Also:
-
InternalHousekeepingContext.getTemplateNameStack()
-
pushCurrentMacroName
- Since:
- 1.6
- See Also:
-
InternalHousekeepingContext.pushCurrentMacroName(java.lang.String)
-
popCurrentMacroName
public void popCurrentMacroName()- Since:
- 1.6
- See Also:
-
InternalHousekeepingContext.popCurrentMacroName()
-
getCurrentMacroName
- Since:
- 1.6
- See Also:
-
InternalHousekeepingContext.getCurrentMacroName()
-
getCurrentMacroCallDepth
public int getCurrentMacroCallDepth()- Since:
- 1.6
- See Also:
-
InternalHousekeepingContext.getCurrentMacroCallDepth()
-
getMacroNameStack
- Since:
- 1.6
- See Also:
-
InternalHousekeepingContext.getMacroNameStack()
-
icacheGet
- See Also:
-
InternalHousekeepingContext.icacheGet(java.lang.Object)
-
icachePut
- See Also:
-
InternalHousekeepingContext.icachePut(java.lang.Object, org.apache.velocity.util.introspection.IntrospectionCacheData)
-
setCurrentResource
- See Also:
-
InternalHousekeepingContext.setCurrentResource(org.apache.velocity.runtime.resource.Resource)
-
getCurrentResource
- See Also:
-
InternalHousekeepingContext.getCurrentResource()
-
setMacroLibraries
- Since:
- 1.6
- See Also:
-
InternalHousekeepingContext.setMacroLibraries(List)
-
getMacroLibraries
- Since:
- 1.6
- See Also:
-
InternalHousekeepingContext.getMacroLibraries()
-
put
Description copied from interface:Context
Adds a name/value pair to the context. -
localPut
Description copied from interface:InternalWrapperContext
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
- Parameters:
key
- name of item to set.value
- object to set to key.- Returns:
- old stored object
- Since:
- 1.5
- See Also:
-
get
Description copied from interface:Context
Gets the value corresponding to the provided key from the context. -
containsKey
Description copied from interface:Context
Indicates whether the specified key is in the context.- Specified by:
containsKey
in interfaceContext
- Parameters:
key
- The key to look for.- Returns:
- Whether the key is in the context.
- See Also:
-
getKeys
Description copied from interface:Context
Get all the keys for the values in the context. -
remove
Description copied from interface:Context
Removes the value associated with the specified key from the context. -
getInternalUserContext
returns the user data context that we are wrapping- Specified by:
getInternalUserContext
in interfaceInternalWrapperContext
- Returns:
- The internal user data context.
-
getBaseContext
Returns the base context that we are wrapping. Here, its this, but for other thing like VM related context contortions, it can be something else- Specified by:
getBaseContext
in interfaceInternalWrapperContext
- Returns:
- The base context.
-
attachEventCartridge
- Specified by:
attachEventCartridge
in interfaceInternalEventContext
- Returns:
- The old EventCartridge.
- See Also:
-
getEventCartridge
- Specified by:
getEventCartridge
in interfaceInternalEventContext
- Returns:
- The current EventCartridge.
- See Also:
-