Class ChainedVelocityContext
- java.lang.Object
-
- org.apache.velocity.context.AbstractContext
-
- org.apache.velocity.VelocityContext
-
- com.atlassian.confluence.velocity.context.ChainedVelocityContext
-
- All Implemented Interfaces:
Cloneable,org.apache.velocity.context.Context,org.apache.velocity.context.InternalEventContext
public final class ChainedVelocityContext extends org.apache.velocity.VelocityContextReplace the chaining provided byAbstractContextbecause it has broken implementations of containsKey() and getKeys() in Velocity 1.5.This class works around the broken implementations of containsKey() by checking the result of get() instead.
-
-
Constructor Summary
Constructors Constructor Description ChainedVelocityContext(org.apache.velocity.context.Context delegate)Creates a new chained context using the provided delegate context for secondary lookups.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.velocity.app.event.EventCartridgeattachEventCartridge(org.apache.velocity.app.event.EventCartridge arg0)booleangetAllowRendering()intgetCurrentMacroCallDepth()StringgetCurrentMacroName()org.apache.velocity.runtime.resource.ResourcegetCurrentResource()StringgetCurrentTemplateName()org.apache.velocity.app.event.EventCartridgegetEventCartridge()ListgetMacroLibraries()Object[]getMacroNameStack()Object[]getTemplateNameStack()org.apache.velocity.util.introspection.IntrospectionCacheDataicacheGet(Object arg0)voidicachePut(Object arg0, org.apache.velocity.util.introspection.IntrospectionCacheData arg1)booleaninternalContainsKey(Object key)ObjectinternalGet(String key)Object[]internalGetKeys()This method is inherently unreliable because the implementation of AbstractContext.getKeys() used in other Velocity contexts doesn't delegate correctly.voidpopCurrentMacroName()voidpopCurrentTemplateName()voidpushCurrentMacroName(String arg0)voidpushCurrentTemplateName(String arg0)voidsetAllowRendering(boolean arg0)voidsetCurrentResource(org.apache.velocity.runtime.resource.Resource arg0)voidsetMacroLibraries(List arg0)
-
-
-
Constructor Detail
-
ChainedVelocityContext
public ChainedVelocityContext(org.apache.velocity.context.Context delegate)
Creates a new chained context using the provided delegate context for secondary lookups.- Parameters:
delegate- the delegate context which is checked after this context- Throws:
IllegalArgumentException- if delegate is null
-
-
Method Detail
-
internalGet
public Object internalGet(String key)
- Overrides:
internalGetin classorg.apache.velocity.VelocityContext
-
internalContainsKey
public boolean internalContainsKey(Object key)
- Overrides:
internalContainsKeyin classorg.apache.velocity.VelocityContext
-
internalGetKeys
public Object[] internalGetKeys()
This method is inherently unreliable because the implementation of AbstractContext.getKeys() used in other Velocity contexts doesn't delegate correctly. Because of this, the result may not contains all the keys of the delegate context.- Overrides:
internalGetKeysin classorg.apache.velocity.VelocityContext
-
pushCurrentTemplateName
public void pushCurrentTemplateName(String arg0)
-
popCurrentTemplateName
public void popCurrentTemplateName()
-
getCurrentTemplateName
public String getCurrentTemplateName()
-
getTemplateNameStack
public Object[] getTemplateNameStack()
-
pushCurrentMacroName
public void pushCurrentMacroName(String arg0)
-
popCurrentMacroName
public void popCurrentMacroName()
-
getCurrentMacroName
public String getCurrentMacroName()
-
getCurrentMacroCallDepth
public int getCurrentMacroCallDepth()
-
getMacroNameStack
public Object[] getMacroNameStack()
-
icacheGet
public org.apache.velocity.util.introspection.IntrospectionCacheData icacheGet(Object arg0)
-
icachePut
public void icachePut(Object arg0, org.apache.velocity.util.introspection.IntrospectionCacheData arg1)
-
setCurrentResource
public void setCurrentResource(org.apache.velocity.runtime.resource.Resource arg0)
-
getCurrentResource
public org.apache.velocity.runtime.resource.Resource getCurrentResource()
-
getAllowRendering
public boolean getAllowRendering()
-
setAllowRendering
public void setAllowRendering(boolean arg0)
-
setMacroLibraries
public void setMacroLibraries(List arg0)
-
getMacroLibraries
public List getMacroLibraries()
-
attachEventCartridge
public org.apache.velocity.app.event.EventCartridge attachEventCartridge(org.apache.velocity.app.event.EventCartridge arg0)
- Specified by:
attachEventCartridgein interfaceorg.apache.velocity.context.InternalEventContext
-
getEventCartridge
public org.apache.velocity.app.event.EventCartridge getEventCartridge()
- Specified by:
getEventCartridgein interfaceorg.apache.velocity.context.InternalEventContext
-
-