public class VelocityContext extends AbstractContext implements Cloneable
Context
Constructor and Description |
---|
VelocityContext()
Creates a new instance (with no inner context).
|
VelocityContext(Context innerContext)
Chaining constructor, used when you want to
wrap a context in another.
|
VelocityContext(Map<String,Object> context)
Creates a new instance with the provided storage (and no inner
context).
|
VelocityContext(Map<String,Object> context,
Context innerContext)
Initializes internal storage (never to
null ), and
inner context. |
Modifier and Type | Method and Description |
---|---|
EventCartridge |
attachEventCartridge(EventCartridge ec) |
Object |
clone()
Clones this context object.
|
int |
getCurrentMacroCallDepth()
get the current macro call depth
|
String |
getCurrentMacroName()
get the current macro name
|
Resource |
getCurrentResource()
temporary fix to enable #include() to figure out
current encoding.
|
String |
getCurrentTemplateName()
get the current template name
|
EventCartridge |
getEventCartridge() |
List |
getMacroLibraries()
Get the macro library list for the current template.
|
String[] |
getMacroNameStack()
get the current macro name stack
|
String[] |
getTemplateNameStack()
get the current template name stack
|
IntrospectionCacheData |
icacheGet(Object key)
returns an IntrospectionCache Data (@see IntrospectionCacheData)
object if exists for the key
|
void |
icachePut(Object key,
IntrospectionCacheData o)
places an IntrospectionCache Data (@see IntrospectionCacheData)
element in the cache for specified key
|
boolean |
internalContainsKey(String key)
determines if there is a value for the
given key
|
Object |
internalGet(String key)
retrieves value for key from internal
storage
|
String[] |
internalGetKeys()
returns array of keys
|
Object |
internalPut(String key,
Object value)
stores the value for key to internal
storage
|
Object |
internalRemove(String key)
remove a key/value pair from the
internal storage
|
void |
popCurrentMacroName()
remove the current macro name from stack
|
void |
popCurrentTemplateName()
remove the current template name from stack
|
void |
pushCurrentMacroName(String s)
set the current macro name on top of stack
|
void |
pushCurrentTemplateName(String s)
set the current template name on top of stack
|
void |
setCurrentResource(Resource r) |
void |
setMacroLibraries(List macroLibraries)
Set the macro library list for the current template.
|
containsKey, get, getChainedContext, getKeys, put, remove
public VelocityContext()
public VelocityContext(Map<String,Object> context)
context
- public VelocityContext(Context innerContext)
innerContext
- The Context
implementation to
wrap.public Object internalGet(String key)
internalGet
in class AbstractContext
key
- name of value to getpublic Object internalPut(String key, Object value)
internalPut
in class AbstractContext
key
- name of value to storevalue
- value to storepublic boolean internalContainsKey(String key)
internalContainsKey
in class AbstractContext
key
- name of value to checkpublic String[] internalGetKeys()
internalGetKeys
in class AbstractContext
public Object internalRemove(String key)
internalRemove
in class AbstractContext
key
- name of value to removepublic Object clone()
public void pushCurrentTemplateName(String s)
s
- current template namepublic void popCurrentTemplateName()
public String getCurrentTemplateName()
public String[] getTemplateNameStack()
public void pushCurrentMacroName(String s)
s
- current macro namepublic void popCurrentMacroName()
public String getCurrentMacroName()
public int getCurrentMacroCallDepth()
public String[] getMacroNameStack()
public IntrospectionCacheData icacheGet(Object key)
key
- key to find in cachepublic void icachePut(Object key, IntrospectionCacheData o)
key
- keyo
- IntrospectionCacheData object to place in cachepublic void setCurrentResource(Resource r)
InternalHousekeepingContext.setCurrentResource(org.apache.velocity.runtime.resource.Resource)
public Resource getCurrentResource()
InternalHousekeepingContext.getCurrentResource()
public void setMacroLibraries(List macroLibraries)
macroLibraries
- list of macro libraries to setInternalHousekeepingContext.setMacroLibraries(List)
public List getMacroLibraries()
InternalHousekeepingContext.getMacroLibraries()
public EventCartridge attachEventCartridge(EventCartridge ec)
attachEventCartridge
in interface InternalEventContext
InternalEventContext.attachEventCartridge(org.apache.velocity.app.event.EventCartridge)
public EventCartridge getEventCartridge()
getEventCartridge
in interface InternalEventContext
InternalEventContext.getEventCartridge()
Copyright © 2000–2020 The Apache Software Foundation. All rights reserved.