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 TypeMethodDescriptionboolean
containsKey
(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.int
returns the user data context that we are wrappingString[]
getKeys()
Get all the keys for the values in the context.String[]
String[]
void
icachePut
(Object key, IntrospectionCacheData o) 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<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:Context
Adds a name/value pair to the context.- Specified by:
put
in interfaceContext
- Specified by:
put
in 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:Context
Gets the value corresponding to the provided key from the context.- Specified by:
get
in interfaceContext
- Specified by:
get
in interfaceInternalWrapperContext
- Parameters:
key
- The name of the desired value.- Returns:
- The value corresponding to the provided key.
- See Also:
-
containsKey
Description copied from interface:Context
Indicates whether the specified key is in the context.- Specified by:
containsKey
in interfaceContext
- Specified by:
containsKey
in interfaceInternalWrapperContext
- 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
- Parameters:
ec
-- Returns:
- The old EventCartridge.
- See Also:
-
getEventCartridge
- Specified by:
getEventCartridge
in interfaceInternalEventContext
- Returns:
- The current EventCartridge.
- See Also:
-