Package org.apache.velocity.context
Class ChainedInternalContextAdapter
java.lang.Object
org.apache.velocity.context.ChainedInternalContextAdapter
- All Implemented Interfaces:
Context,InternalContextAdapter,InternalEventContext,InternalHousekeepingContext,InternalWrapperContext
public abstract class ChainedInternalContextAdapter
extends Object
implements InternalContextAdapter
This is an abstract internal-use-only context implementation to be
used as a subclass for other internal-use-only contexts that wrap
other internal-use-only contexts.
We use this context to make it easier to chain an existing context
as part of a new context implementation. It just delegates everything
to the inner/parent context. Subclasses then only need to override
the methods relevant to them.
- Since:
- 1.6
- Version:
- $Id: ChainedInternalContextAdapter.java 685724 2008-08-13 23:12:12Z nbubna $
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCTOR, wraps an ICA -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsKey(String key) Indicates whether the specified key is in the context.Retrieves from parent context.Returns the base full context impl.intget the current macro call depthget the current macro nametemporary fix to enable #include() to figure out current encoding.get the current template nameReturn the inner / user context.String[]getKeys()Get all the keys for the values in the context.Get the macro library list for the current template.String[]Returns the macro name stack in form of an array.String[]Returns the template name stack in form of an array.returns an IntrospectionCache Data (@see IntrospectionCacheData) object if exists for the keyvoidicachePut(Object key, IntrospectionCacheData o) places an IntrospectionCache Data (@see IntrospectionCacheData) element in the cache for specified keyvoidremove the current macro name from stackvoidremove the current template name from stackvoidset the current macro name on top of stackvoidset the current template name on top of stackPut method also stores values in parent contextRemoves the value associated with the specified key from the context.voidvoidsetMacroLibraries(List<Template> macroLibraries) Set the macro library list for the current template.
-
Field Details
-
wrappedContext
the parent context
-
-
Constructor Details
-
ChainedInternalContextAdapter
CTOR, wraps an ICA- Parameters:
inner- context
-
-
Method Details
-
getInternalUserContext
Return the inner / user context.- Specified by:
getInternalUserContextin interfaceInternalWrapperContext- Returns:
- The inner / user context.
-
getBaseContext
Description copied from interface:InternalWrapperContextReturns the base full context impl.- Specified by:
getBaseContextin interfaceInternalWrapperContext- Returns:
- The base full context impl.
- See Also:
-
get
Retrieves from parent context.- Specified by:
getin interfaceContext- Specified by:
getin interfaceInternalWrapperContext- Parameters:
key- name of item to get- Returns:
- stored object or null
-
put
Put method also stores values in parent context- Specified by:
putin interfaceContext- Specified by:
putin interfaceInternalWrapperContext- Parameters:
key- name of item to setvalue- object to set to key- Returns:
- old stored object
-
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. -
pushCurrentTemplateName
Description copied from interface:InternalHousekeepingContextset the current template name on top of stack- Specified by:
pushCurrentTemplateNamein interfaceInternalHousekeepingContext- Parameters:
s- current template name- See Also:
-
popCurrentTemplateName
public void popCurrentTemplateName()Description copied from interface:InternalHousekeepingContextremove the current template name from stack- Specified by:
popCurrentTemplateNamein interfaceInternalHousekeepingContext- See Also:
-
getCurrentTemplateName
Description copied from interface:InternalHousekeepingContextget the current template name- Specified by:
getCurrentTemplateNamein interfaceInternalHousekeepingContext- Returns:
- String current template name
- See Also:
-
getTemplateNameStack
Description copied from interface:InternalHousekeepingContextReturns the template name stack in form of an array.- Specified by:
getTemplateNameStackin interfaceInternalHousekeepingContext- Returns:
- String[] with the template name stack contents.
- See Also:
-
pushCurrentMacroName
Description copied from interface:InternalHousekeepingContextset the current macro name on top of stack- Specified by:
pushCurrentMacroNamein interfaceInternalHousekeepingContext- Parameters:
s- current macro name- See Also:
-
popCurrentMacroName
public void popCurrentMacroName()Description copied from interface:InternalHousekeepingContextremove the current macro name from stack- Specified by:
popCurrentMacroNamein interfaceInternalHousekeepingContext- See Also:
-
getCurrentMacroName
Description copied from interface:InternalHousekeepingContextget the current macro name- Specified by:
getCurrentMacroNamein interfaceInternalHousekeepingContext- Returns:
- String current macro name
- See Also:
-
getCurrentMacroCallDepth
public int getCurrentMacroCallDepth()Description copied from interface:InternalHousekeepingContextget the current macro call depth- Specified by:
getCurrentMacroCallDepthin interfaceInternalHousekeepingContext- Returns:
- int current macro call depth
- See Also:
-
getMacroNameStack
Description copied from interface:InternalHousekeepingContextReturns the macro name stack in form of an array.- Specified by:
getMacroNameStackin interfaceInternalHousekeepingContext- Returns:
- String[] with the macro name stack contents.
- See Also:
-
icacheGet
Description copied from interface:InternalHousekeepingContextreturns an IntrospectionCache Data (@see IntrospectionCacheData) object if exists for the key- Specified by:
icacheGetin interfaceInternalHousekeepingContext- Parameters:
key- key to find in cache- Returns:
- cache object
- See Also:
-
icachePut
Description copied from interface:InternalHousekeepingContextplaces an IntrospectionCache Data (@see IntrospectionCacheData) element in the cache for specified key- Specified by:
icachePutin interfaceInternalHousekeepingContext- Parameters:
key- keyo- IntrospectionCacheData object to place in cache- See Also:
-
setMacroLibraries
Description copied from interface:InternalHousekeepingContextSet the macro library list for the current template.- Specified by:
setMacroLibrariesin interfaceInternalHousekeepingContext- Parameters:
macroLibraries- list of macro libraries to set- See Also:
-
getMacroLibraries
Description copied from interface:InternalHousekeepingContextGet the macro library list for the current template.- Specified by:
getMacroLibrariesin interfaceInternalHousekeepingContext- Returns:
- List of macro library names
- See Also:
-
attachEventCartridge
- Specified by:
attachEventCartridgein interfaceInternalEventContext- Parameters:
ec-- Returns:
- The old EventCartridge.
- See Also:
-
getEventCartridge
- Specified by:
getEventCartridgein interfaceInternalEventContext- Returns:
- The current EventCartridge.
- See Also:
-
setCurrentResource
- Specified by:
setCurrentResourcein interfaceInternalHousekeepingContext- Parameters:
r-- See Also:
-
getCurrentResource
Description copied from interface:InternalHousekeepingContexttemporary fix to enable #include() to figure out current encoding.- Specified by:
getCurrentResourcein interfaceInternalHousekeepingContext- Returns:
- The current resource.
- See Also:
-