|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.velocity.tools.Toolbox
public class Toolbox
Instances of this class are typically created by a ToolboxFactory
on a one-per-scope basis. So, for each application, there would be one
application-scoped Toolbox from which you would retrieve tool instances,
and for each request, there would be one request-scoped Toolbox.
Of course, none of the above is enforced. There's no reason that you can't
manually create a Toolbox or have multiple Toolboxes for each scope.
When a Toolbox creates a tool instance asked of it (see get(java.lang.String)
),
it will cache that instance for future requests.
Field Summary | |
---|---|
static String |
KEY
The key used to place instances in various scopes. |
Constructor Summary | |
---|---|
Toolbox(Map<String,ToolInfo> toolInfo)
|
|
Toolbox(Map<String,ToolInfo> toolInfo,
Map<String,Object> properties)
|
Method Summary | |
---|---|
protected void |
cacheData(Map<String,Object> data)
|
Toolbox |
combine(Toolbox... toolboxes)
Returns a new Toolbox that is a combination of
this Toolbox with one or more specified Toolbox es. |
Object |
get(String key)
|
Object |
get(String key,
Map<String,Object> context)
|
Object |
get(String key,
String path)
|
Object |
get(String key,
String path,
Map<String,Object> context)
|
Map<String,Object> |
getAll(Map<String,Object> context)
|
protected Object |
getFromCache(String key,
String path)
|
protected Object |
getFromInfo(String key,
String path,
Map<String,Object> context)
|
Set<String> |
getKeys()
|
Map<String,Object> |
getProperties()
|
Map<String,Class> |
getToolClassMap()
Return a new Map link tools' keys to their Class es. |
protected boolean |
hasPermission(ToolInfo info,
String path)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String KEY
Constructor Detail |
---|
public Toolbox(Map<String,ToolInfo> toolInfo)
public Toolbox(Map<String,ToolInfo> toolInfo, Map<String,Object> properties)
Method Detail |
---|
protected void cacheData(Map<String,Object> data)
public Map<String,Object> getProperties()
public Object get(String key)
public Object get(String key, String path)
public Object get(String key, Map<String,Object> context)
public Object get(String key, String path, Map<String,Object> context)
protected Object getFromCache(String key, String path)
protected Object getFromInfo(String key, String path, Map<String,Object> context)
protected boolean hasPermission(ToolInfo info, String path)
public Set<String> getKeys()
public Map<String,Class> getToolClassMap()
Map
link tools' keys to their Class
es.
This will not instantiate any tools, it is merely informational.
This will not include the keys for any cached data. Note that inclusion
in this map does NOT mean that all these tools will be available for
all requests, as this map ignores all path restrictions on the tools.
public Map<String,Object> getAll(Map<String,Object> context)
public Toolbox combine(Toolbox... toolboxes)
Toolbox
that is a combination of
this Toolbox with one or more specified Toolbox
es.
Neither this instance nor those specified are modified.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |