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$
- Author:
- Geir Magnusson Jr.
-
Constructor Summary
ConstructorsConstructorDescriptionCTOR takes a Context and wraps it, delegating all 'data' calls to it. -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsKey(String 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.intreturns the user data context that we are wrappingString[]getKeys()Get all the keys for the values in the context.String[]String[]voidicachePut(Object key, IntrospectionCacheData o) voidvoidvoidvoidAdds a name/value pair to the context.Removes the value associated with the specified key from the context.voidvoidsetMacroLibraries(List<Template> 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:
-
popCurrentTemplateName
public void popCurrentTemplateName()- See Also:
-
getCurrentTemplateName
- See Also:
-
getTemplateNameStack
- See Also:
-
pushCurrentMacroName
- Since:
- 1.6
- See Also:
-
popCurrentMacroName
public void popCurrentMacroName()- Since:
- 1.6
- See Also:
-
getCurrentMacroName
- Since:
- 1.6
- See Also:
-
getCurrentMacroCallDepth
public int getCurrentMacroCallDepth()- Since:
- 1.6
- See Also:
-
getMacroNameStack
- Since:
- 1.6
- See Also:
-
icacheGet
- See Also:
-
icachePut
- See Also:
-
setCurrentResource
- See Also:
-
getCurrentResource
- See Also:
-
setMacroLibraries
- Since:
- 1.6
- See Also:
-
getMacroLibraries
- Since:
- 1.6
- See Also:
-
put
Description copied from interface:ContextAdds a name/value pair to the context.- Specified by:
putin interfaceContext- Specified by:
putin interfaceInternalWrapperContext- Parameters:
key- The name to key the provided value with.value- The corresponding value.- Returns:
- The old object or null if there was no old object.
- See Also:
-
get
Description copied from interface:ContextGets the value corresponding to the provided key from the context.- Specified by:
getin interfaceContext- Specified by:
getin interfaceInternalWrapperContext- Parameters:
key- The name of the desired value.- Returns:
- The value corresponding to the provided key.
- See Also:
-
containsKey
Description copied from interface:ContextIndicates whether the specified key is in the context.- Specified by:
containsKeyin interfaceContext- Specified by:
containsKeyin interfaceInternalWrapperContext- Parameters:
key- The key to look for.- Returns:
- Whether the key is in the context.
- See Also:
-
getKeys
Description copied from interface:ContextGet all the keys for the values in the context. -
remove
Description copied from interface:ContextRemoves the value associated with the specified key from the context. -
getInternalUserContext
returns the user data context that we are wrapping- Specified by:
getInternalUserContextin 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:
getBaseContextin interfaceInternalWrapperContext- Returns:
- The base context.
-
attachEventCartridge
- Specified by:
attachEventCartridgein interfaceInternalEventContext- Parameters:
ec-- Returns:
- The old EventCartridge.
- See Also:
-
getEventCartridge
- Specified by:
getEventCartridgein interfaceInternalEventContext- Returns:
- The current EventCartridge.
- See Also:
-