Package org.apache.velocity.context
Interface InternalHousekeepingContext
-
- All Known Subinterfaces:
InternalContextAdapter
- All Known Implementing Classes:
AbstractContext,ChainedInternalContextAdapter,EvaluateContext,Foreach.NullHolderContext,InternalContextAdapterImpl,InternalContextBase,ProxyVMContext,VelocityContext
interface InternalHousekeepingContextinterface to encapsulate the 'stuff' for internal operation of velocity. We use the context as a thread-safe storage : we take advantage of the fact that it's a visitor of sorts to all nodes (that matter) of the AST during init() and render(). Currently, it carries the template name for namespace support, as well as node-local context data introspection caching.- Version:
- $Id: InternalHousekeepingContext.java 731266 2009-01-04 15:11:20Z byron $
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intgetCurrentMacroCallDepth()get the current macro call depthjava.lang.StringgetCurrentMacroName()get the current macro nameResourcegetCurrentResource()temporary fix to enable #include() to figure out current encoding.java.lang.StringgetCurrentTemplateName()get the current template namejava.util.ListgetMacroLibraries()Get the macro library list for the current template.java.lang.Object[]getMacroNameStack()Returns the macro name stack in form of an array.java.lang.Object[]getTemplateNameStack()Returns the template name stack in form of an array.IntrospectionCacheDataicacheGet(java.lang.Object key)returns an IntrospectionCache Data (@see IntrospectionCacheData) object if exists for the keyvoidicachePut(java.lang.Object key, IntrospectionCacheData o)places an IntrospectionCache Data (@see IntrospectionCacheData) element in the cache for specified keyvoidpopCurrentMacroName()remove the current macro name from stackvoidpopCurrentTemplateName()remove the current template name from stackvoidpushCurrentMacroName(java.lang.String s)set the current macro name on top of stackvoidpushCurrentTemplateName(java.lang.String s)set the current template name on top of stackvoidsetCurrentResource(Resource r)voidsetMacroLibraries(java.util.List macroLibraries)Set the macro library list for the current template.
-
-
-
Method Detail
-
pushCurrentTemplateName
void pushCurrentTemplateName(java.lang.String s)
set the current template name on top of stack- Parameters:
s- current template name
-
popCurrentTemplateName
void popCurrentTemplateName()
remove the current template name from stack
-
getCurrentTemplateName
java.lang.String getCurrentTemplateName()
get the current template name- Returns:
- String current template name
-
getTemplateNameStack
java.lang.Object[] getTemplateNameStack()
Returns the template name stack in form of an array.- Returns:
- Object[] with the template name stack contents.
-
pushCurrentMacroName
void pushCurrentMacroName(java.lang.String s)
set the current macro name on top of stack- Parameters:
s- current macro name
-
popCurrentMacroName
void popCurrentMacroName()
remove the current macro name from stack
-
getCurrentMacroName
java.lang.String getCurrentMacroName()
get the current macro name- Returns:
- String current macro name
-
getCurrentMacroCallDepth
int getCurrentMacroCallDepth()
get the current macro call depth- Returns:
- int current macro call depth
-
getMacroNameStack
java.lang.Object[] getMacroNameStack()
Returns the macro name stack in form of an array.- Returns:
- Object[] with the macro name stack contents.
-
icacheGet
IntrospectionCacheData icacheGet(java.lang.Object key)
returns an IntrospectionCache Data (@see IntrospectionCacheData) object if exists for the key- Parameters:
key- key to find in cache- Returns:
- cache object
-
icachePut
void icachePut(java.lang.Object key, IntrospectionCacheData o)places an IntrospectionCache Data (@see IntrospectionCacheData) element in the cache for specified key- Parameters:
key- keyo- IntrospectionCacheData object to place in cache
-
getCurrentResource
Resource getCurrentResource()
temporary fix to enable #include() to figure out current encoding.- Returns:
- The current resource.
-
setCurrentResource
void setCurrentResource(Resource r)
- Parameters:
r-
-
setMacroLibraries
void setMacroLibraries(java.util.List macroLibraries)
Set the macro library list for the current template.- Parameters:
macroLibraries- list of macro libraries to set
-
getMacroLibraries
java.util.List getMacroLibraries()
Get the macro library list for the current template.- Returns:
- List of macro library names
-
-