Package org.apache.velocity.context
Class ChainedInternalContextAdapter
- java.lang.Object
-
- org.apache.velocity.context.ChainedInternalContextAdapter
-
- All Implemented Interfaces:
Context,InternalContextAdapter,InternalEventContext,InternalWrapperContext
public abstract class ChainedInternalContextAdapter extends java.lang.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 $
- Author:
- Nathan Bubna
-
-
Field Summary
Fields Modifier and Type Field Description protected InternalContextAdapterwrappedContextthe parent context
-
Constructor Summary
Constructors Constructor Description ChainedInternalContextAdapter(InternalContextAdapter inner)CTOR, wraps an ICA
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EventCartridgeattachEventCartridge(EventCartridge ec)booleancontainsKey(java.lang.String key)Indicates whether the specified key is in the context.java.lang.Objectget(java.lang.String key)Retrieves from parent context.InternalContextAdaptergetBaseContext()Returns the base full context impl.intgetCurrentMacroCallDepth()java.lang.StringgetCurrentMacroName()ResourcegetCurrentResource()java.lang.StringgetCurrentTemplateName()EventCartridgegetEventCartridge()ContextgetInternalUserContext()Return the inner / user context.java.lang.String[]getKeys()Get all the keys for the values in the context.java.util.List<Template>getMacroLibraries()java.lang.String[]getMacroNameStack()java.lang.String[]getTemplateNameStack()IntrospectionCacheDataicacheGet(java.lang.Object key)voidicachePut(java.lang.Object key, IntrospectionCacheData o)voidpopCurrentMacroName()voidpopCurrentTemplateName()voidpushCurrentMacroName(java.lang.String s)voidpushCurrentTemplateName(java.lang.String s)java.lang.Objectput(java.lang.String key, java.lang.Object value)Put method also stores values in parent contextjava.lang.Objectremove(java.lang.String key)Removes the value associated with the specified key from the context.voidsetCurrentResource(Resource r)voidsetMacroLibraries(java.util.List<Template> macroLibraries)
-
-
-
Field Detail
-
wrappedContext
protected InternalContextAdapter wrappedContext
the parent context
-
-
Constructor Detail
-
ChainedInternalContextAdapter
public ChainedInternalContextAdapter(InternalContextAdapter inner)
CTOR, wraps an ICA- Parameters:
inner- context
-
-
Method Detail
-
getInternalUserContext
public Context getInternalUserContext()
Return the inner / user context.- Specified by:
getInternalUserContextin interfaceInternalWrapperContext- Returns:
- The inner / user context.
-
getBaseContext
public InternalContextAdapter getBaseContext()
Description copied from interface:InternalWrapperContextReturns the base full context impl.- Specified by:
getBaseContextin interfaceInternalWrapperContext- Returns:
- The base full context impl.
- See Also:
InternalWrapperContext.getBaseContext()
-
get
public java.lang.Object get(java.lang.String key)
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
public java.lang.Object put(java.lang.String key, java.lang.Object value)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
public boolean containsKey(java.lang.String key)
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:
Context.containsKey(java.lang.String)
-
getKeys
public java.lang.String[] getKeys()
Description copied from interface:ContextGet all the keys for the values in the context.- Specified by:
getKeysin interfaceContext- Returns:
- All the keys for the values in the context.
- See Also:
Context.getKeys()
-
remove
public java.lang.Object remove(java.lang.String key)
Description copied from interface:ContextRemoves the value associated with the specified key from the context.- Specified by:
removein interfaceContext- Parameters:
key- The name of the value to remove.- Returns:
- The value that the key was mapped to, or
nullif unmapped. - See Also:
Context.remove(java.lang.String)
-
pushCurrentTemplateName
public void pushCurrentTemplateName(java.lang.String s)
- See Also:
InternalHousekeepingContext.pushCurrentTemplateName(java.lang.String)
-
popCurrentTemplateName
public void popCurrentTemplateName()
- See Also:
InternalHousekeepingContext.popCurrentTemplateName()
-
getCurrentTemplateName
public java.lang.String getCurrentTemplateName()
- See Also:
InternalHousekeepingContext.getCurrentTemplateName()
-
getTemplateNameStack
public java.lang.String[] getTemplateNameStack()
- See Also:
InternalHousekeepingContext.getTemplateNameStack()
-
pushCurrentMacroName
public void pushCurrentMacroName(java.lang.String s)
- See Also:
InternalHousekeepingContext.pushCurrentMacroName(java.lang.String)
-
popCurrentMacroName
public void popCurrentMacroName()
- See Also:
InternalHousekeepingContext.popCurrentMacroName()
-
getCurrentMacroName
public java.lang.String getCurrentMacroName()
- See Also:
InternalHousekeepingContext.getCurrentMacroName()
-
getCurrentMacroCallDepth
public int getCurrentMacroCallDepth()
- See Also:
InternalHousekeepingContext.getCurrentMacroCallDepth()
-
getMacroNameStack
public java.lang.String[] getMacroNameStack()
- See Also:
InternalHousekeepingContext.getMacroNameStack()
-
icacheGet
public IntrospectionCacheData icacheGet(java.lang.Object key)
- See Also:
InternalHousekeepingContext.icacheGet(java.lang.Object)
-
icachePut
public void icachePut(java.lang.Object key, IntrospectionCacheData o)- See Also:
InternalHousekeepingContext.icachePut(java.lang.Object, org.apache.velocity.util.introspection.IntrospectionCacheData)
-
setMacroLibraries
public void setMacroLibraries(java.util.List<Template> macroLibraries)
- See Also:
InternalHousekeepingContext.setMacroLibraries(List)
-
getMacroLibraries
public java.util.List<Template> getMacroLibraries()
- See Also:
InternalHousekeepingContext.getMacroLibraries()
-
attachEventCartridge
public EventCartridge attachEventCartridge(EventCartridge ec)
- Specified by:
attachEventCartridgein interfaceInternalEventContext- Returns:
- The old EventCartridge.
- See Also:
InternalEventContext.attachEventCartridge(org.apache.velocity.app.event.EventCartridge)
-
getEventCartridge
public EventCartridge getEventCartridge()
- Specified by:
getEventCartridgein interfaceInternalEventContext- Returns:
- The current EventCartridge.
- See Also:
InternalEventContext.getEventCartridge()
-
setCurrentResource
public void setCurrentResource(Resource r)
- See Also:
InternalHousekeepingContext.setCurrentResource(org.apache.velocity.runtime.resource.Resource)
-
getCurrentResource
public Resource getCurrentResource()
- See Also:
InternalHousekeepingContext.getCurrentResource()
-
-