|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.velocity.tools.generic.SafeConfig
org.apache.velocity.tools.generic.ContextTool
@DefaultKey(value="context")
@InvalidScope(value={"application","session"})
public class ContextTool
Tool for convenient access to Context data and
meta-data.
Template example(s):
#foreach( $key in $context.keys )
$key = $context.get($key)
#end
Toolbox configuration:
<tools>
<toolbox scope="request">
<tool class="org.apache.velocity.tools.generic.ContextTool"/>
</toolbox>
</tools>
This class is only designed for use as a request-scope tool.
| Field Summary | |
|---|---|
protected org.apache.velocity.context.Context |
context
|
protected Map<String,Object> |
toolbox
|
| Fields inherited from class org.apache.velocity.tools.generic.SafeConfig |
|---|
LOCK_CONFIG_KEY, OLD_LOCK_CONFIG_KEY, SAFE_MODE_KEY |
| Constructor Summary | |
|---|---|
ContextTool()
|
|
| Method Summary | |
|---|---|
protected void |
configure(ValueParser parser)
Initializes this instance for the current request. |
boolean |
contains(Object refName)
Returns true if the context contains a value for the specified
reference name (aka context key). |
protected void |
fillKeyset(Set keys)
Actually do the work of filling in the set of keys for getKeys() here so subclasses can add keys too. |
Object |
get(Object refName)
Retrieves the value for the specified reference name (aka context key). |
Set |
getKeys()
Return a Set of the available reference keys in the current
context. |
org.apache.velocity.context.Context |
getThis()
Returns the context being analyzed by this tool. |
Map<String,Object> |
getToolbox()
Returns a read-only view of the toolbox Map
for this context. |
Set |
getValues()
Return a Set of the available values in the current
context. |
| Methods inherited from class org.apache.velocity.tools.generic.SafeConfig |
|---|
configure, isConfigLocked, isSafeMode, setLockConfig, setSafeMode |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected org.apache.velocity.context.Context context
protected Map<String,Object> toolbox
| Constructor Detail |
|---|
public ContextTool()
| Method Detail |
|---|
protected void configure(ValueParser parser)
configure in class SafeConfigpublic org.apache.velocity.context.Context getThis()
public Map<String,Object> getToolbox()
Returns a read-only view of the toolbox Map
for this context.
null if such a map is not availablepublic Set getKeys()
Return a Set of the available reference keys in the current
context.
protected void fillKeyset(Set keys)
getKeys() here so subclasses can add keys too.
public Set getValues()
Return a Set of the available values in the current
context.
public boolean contains(Object refName)
Returns true if the context contains a value for the specified
reference name (aka context key).
public Object get(Object refName)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||