|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.velocity.context.AbstractContext
public abstract class AbstractContext
This class is the abstract base class for all conventional Velocity Context implementations. Simply extend this class and implement the abstract routines that access your preferred storage method. Takes care of context chaining. Also handles / enforces policy on null keys and values :
Constructor Summary | |
---|---|
AbstractContext()
default CTOR |
|
AbstractContext(Context inner)
Chaining constructor accepts a Context argument. |
Method Summary | |
---|---|
EventCartridge |
attachEventCartridge(EventCartridge ec)
|
boolean |
containsKey(Object key)
Indicates whether the specified key is in the context. |
Object |
get(String key)
Gets the value corresponding to the provided key from the context. |
boolean |
getAllowRendering()
Checks to see if rendering should be allowed. |
Context |
getChainedContext()
returns innerContext if one is chained |
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()
|
Object[] |
getKeys()
Get all the keys for the values in the context |
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 |
abstract boolean |
internalContainsKey(Object key)
Implement to determine if a key is in the storage. |
abstract Object |
internalGet(String key)
Implement to return a value from the context storage. |
abstract Object[] |
internalGetKeys()
Implement to return an object array of key strings from your storage. |
abstract Object |
internalPut(String key,
Object value)
Implement to put a value into the context storage. |
abstract Object |
internalRemove(Object key)
I mplement to remove an item from your 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 |
Object |
put(String key,
Object value)
Adds a name/value pair to the context. |
Object |
remove(Object key)
Removes the value associated with the specified key from the context. |
void |
setAllowRendering(boolean v)
Set whether rendering is allowed. |
void |
setCurrentResource(Resource r)
|
void |
setMacroLibraries(List macroLibraries)
Set the macro library list for the current template. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractContext()
public AbstractContext(Context inner)
inner
- context to be chainedMethod Detail |
---|
public abstract Object internalGet(String key)
key
- key whose associated value is to be returned
public abstract Object internalPut(String key, Object value)
key
- key with which to associate the valuevalue
- value to be associated with the key
public abstract boolean internalContainsKey(Object key)
key
- key to test for existance
public abstract Object[] internalGetKeys()
public abstract Object internalRemove(Object key)
key
- key to remove
public Object put(String key, Object value)
put
in interface Context
key
- The name to key the provided value with.value
- The corresponding value.
public Object get(String key)
get
in interface Context
key
- The name of the desired value.
public boolean containsKey(Object key)
containsKey
in interface Context
key
- The key to look for.
public Object[] getKeys()
getKeys
in interface Context
public Object remove(Object key)
remove
in interface Context
key
- The name of the value to remove.
null
if unmapped.public Context getChainedContext()
null
if notpublic 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 boolean getAllowRendering()
InternalHousekeepingContext.getAllowRendering()
public void setAllowRendering(boolean v)
InternalHousekeepingContext.setAllowRendering(boolean)
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 |