类 ToolContext
java.lang.Object
org.apache.velocity.tools.ToolContext
- 所有已实现的接口:
org.apache.velocity.context.Context
- 直接已知子类:
ViewToolContext
Context
implementation that keeps a list of Toolbox
es
and returns them as requested, using its internal context Map as the
dynamic properties passed to the requested tools when they are first
created.- 版本:
- $Id: ToolContext.java 511959 2007-02-26 19:24:39Z nbubna $
- 作者:
- Nathan Bubna
-
字段概要
字段 -
构造器概要
构造器构造器说明ToolContext
(Map<String, Object> toolProps) Creates an instance starting with the specified tool properties.ToolContext
(org.apache.velocity.app.VelocityEngine engine) Creates an instance that automatically has the specified VelocityEngine and related tool properties set. -
方法概要
修饰符和类型方法说明void
addToolbox
(Toolbox toolbox) boolean
containsKey
(Object key) protected Object
Object[]
getKeys()
Returns aMap
of all tools available to this context.Gets a map of keys to classes for all available tools.boolean
Default istrue
.protected Object
internalGet
(String key) keySet()
void
void
putToolProperties
(Map<String, Object> props) putToolProperty
(String key, Object value) void
putVelocityEngine
(org.apache.velocity.app.VelocityEngine engine) Puts the specified VelocityEngine in the tool properties, as well as the Log for that engine.void
setUserCanOverwriteTools
(boolean overwrite) Set whether or not tool references can be overwritten within a template.
-
字段详细资料
-
构造器详细资料
-
ToolContext
public ToolContext() -
ToolContext
public ToolContext(org.apache.velocity.app.VelocityEngine engine) Creates an instance that automatically has the specified VelocityEngine and related tool properties set. -
ToolContext
Creates an instance starting with the specified tool properties.
-
-
方法详细资料
-
setUserCanOverwriteTools
public void setUserCanOverwriteTools(boolean overwrite) Set whether or not tool references can be overwritten within a template. The default value istrue
. Set this to false if you want to ensure that your tool references are never replaced within the course of a template. -
getUserCanOverwriteTools
public boolean getUserCanOverwriteTools()Default istrue
. -
addToolbox
-
getToolbox
Returns aMap
of all tools available to this context. NOTE: this is not a cheap operation as it will request and initialize an instance of every available tool. -
getToolClassMap
Gets a map of keys to classes for all available tools. This does not include any data nor any local context values. -
getToolboxes
-
getToolProperties
-
putVelocityEngine
public void putVelocityEngine(org.apache.velocity.app.VelocityEngine engine) Puts the specified VelocityEngine in the tool properties, as well as the Log for that engine. Last, if the specified engine has a MethodExceptionEventHandler configured, then this will automatically setCATCH_EXCEPTIONS_KEY
to false in the tool properties. -
putToolProperty
-
putToolProperties
-
put
- 指定者:
put
在接口中org.apache.velocity.context.Context
-
get
- 指定者:
get
在接口中org.apache.velocity.context.Context
-
internalGet
-
findTool
-
keySet
-
containsKey
- 指定者:
containsKey
在接口中org.apache.velocity.context.Context
-
getKeys
- 指定者:
getKeys
在接口中org.apache.velocity.context.Context
-
remove
- 指定者:
remove
在接口中org.apache.velocity.context.Context
-
putAll
-