|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.velocity.context.AbstractContext org.apache.velocity.VelocityContext
public class VelocityContext
General purpose implemention of the application Context interface for general application use. This class should be used in place of the original Context class. This implementation uses a HashMap (@see java.util.HashMap ) for data storage. This context implementation cannot be shared between threads without those threads synchronizing access between them, as the HashMap is not synchronized, nor are some of the fundamentals of AbstractContext. If you need to share a Context between threads with simultaneous access for some reason, please create your own and extend the interface Context
Context
Constructor Summary | |
---|---|
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 context)
Creates a new instance with the provided storage (and no inner context). |
|
VelocityContext(Map context,
Context innerContext)
Initializes internal storage (never to null ), and
inner context. |
Method Summary | |
---|---|
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. |
Object[] |
getMacroNameStack()
get the current macro name stack |
Object[] |
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(Object key)
determines if there is a value for the given key |
Object |
internalGet(String key)
retrieves value for key from internal storage |
Object[] |
internalGetKeys()
returns array of keys |
Object |
internalPut(String key,
Object value)
stores the value for key to internal storage |
Object |
internalRemove(Object 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. |
Methods inherited from class org.apache.velocity.context.AbstractContext |
---|
containsKey, get, getChainedContext, getKeys, put, remove |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public VelocityContext()
public VelocityContext(Map context)
context
- public VelocityContext(Context innerContext)
innerContext
- The Context
implementation to
wrap.public VelocityContext(Map context, Context innerContext)
null
), and
inner context.
context
- Internal storage, or null
to
create default storage.innerContext
- Inner context.Method Detail |
---|
public Object internalGet(String key)
internalGet
in class AbstractContext
key
- name of value to get
public Object internalPut(String key, Object value)
internalPut
in class AbstractContext
key
- name of value to storevalue
- value to store
public boolean internalContainsKey(Object key)
internalContainsKey
in class AbstractContext
key
- name of value to check
public Object[] internalGetKeys()
internalGetKeys
in class AbstractContext
public Object internalRemove(Object key)
internalRemove
in class AbstractContext
key
- name of value to remove
public Object clone()
clone
in class Object
Context
.public void pushCurrentTemplateName(String s)
s
- current template namepublic void popCurrentTemplateName()
public String getCurrentTemplateName()
public Object[] getTemplateNameStack()
public void pushCurrentMacroName(String s)
s
- current macro namepublic void popCurrentMacroName()
public String getCurrentMacroName()
public int getCurrentMacroCallDepth()
public Object[] getMacroNameStack()
public IntrospectionCacheData icacheGet(Object key)
key
- key to find in cache
public 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()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |