|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.velocity.context.ChainedInternalContextAdapter org.apache.velocity.context.ProxyVMContext
public class ProxyVMContext
Context for Velocity macro arguments. This special context combines ideas of earlier VMContext and VMProxyArgs by implementing routing functionality internally. This significantly reduces memory allocation upon macro invocations. Since the macro AST is now shared and RuntimeMacro directive is used, the earlier implementation of precalculating VMProxyArgs would not work. See Issue 607 for more info on this class.
Field Summary |
---|
Fields inherited from class org.apache.velocity.context.ChainedInternalContextAdapter |
---|
innerContext |
Constructor Summary | |
---|---|
ProxyVMContext(InternalContextAdapter inner,
RuntimeServices rsvc,
boolean localContextScope)
|
Method Summary | |
---|---|
void |
addVMProxyArg(InternalContextAdapter context,
String macroArgumentName,
String literalMacroArgumentName,
Node argumentValue)
Used to put Velocity macro arguments into this context. |
boolean |
containsKey(Object key)
Indicates whether the specified key is in the context. |
Object |
get(String key)
Implementation of the Context.get() method. |
Object[] |
getKeys()
Get all the keys for the values in the context. |
Object |
localPut(String key,
Object value)
Allows callers to explicitly put objects in the local context, no matter what the velocimacro.context.local setting says. |
Object |
put(String key,
Object value)
Impl of the Context.put() method. |
protected Object |
put(String key,
Object value,
boolean forceLocal)
Internal put method to select between local and global scope. |
Object |
remove(Object key)
Removes the value associated with the specified key from the context. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ProxyVMContext(InternalContextAdapter inner, RuntimeServices rsvc, boolean localContextScope)
inner
- Velocity context for processingrsvc
- RuntimeServices provides logging referencelocalContextScope
- if true, all references are set to be localMethod Detail |
---|
public void addVMProxyArg(InternalContextAdapter context, String macroArgumentName, String literalMacroArgumentName, Node argumentValue) throws MethodInvocationException
context
- rendering contextmacroArgumentName
- name of the macro argument that we receivedliteralMacroArgumentName
- ".literal.$"+macroArgumentNameargumentValue
- actual value of the macro argument
MethodInvocationException
public Object put(String key, Object value)
put
in interface Context
put
in class ChainedInternalContextAdapter
key
- name of item to setvalue
- object to set to key
public Object localPut(String key, Object value)
localPut
in interface InternalWrapperContext
localPut
in class ChainedInternalContextAdapter
key
- name of item to set.value
- object to set to key.
InternalWrapperContext.localPut(java.lang.String,java.lang.Object)
protected Object put(String key, Object value, boolean forceLocal)
key
- name of item to setvalue
- object to set to keyforceLocal
- True forces the object into the local scope.
public Object get(String key)
get
in interface Context
get
in class ChainedInternalContextAdapter
key
- name of item to get
public boolean containsKey(Object key)
Context
containsKey
in interface Context
containsKey
in class ChainedInternalContextAdapter
key
- The key to look for.
Context.containsKey(java.lang.Object)
public Object[] getKeys()
Context
getKeys
in interface Context
getKeys
in class ChainedInternalContextAdapter
Context.getKeys()
public Object remove(Object key)
Context
remove
in interface Context
remove
in class ChainedInternalContextAdapter
key
- The name of the value to remove.
null
if unmapped.Context.remove(java.lang.Object)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |