类 ToolContext
java.lang.Object
org.apache.velocity.tools.ToolContext
- 所有已实现的接口:
org.apache.velocity.context.Context
Context implementation that keeps a list of Toolboxes
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. -
方法概要
修饰符和类型方法说明voidaddToolbox(Toolbox toolbox) booleancontainsKey(String key) protected ObjectString[]getKeys()Returns aMapof all tools available to this context.Gets a map of keys to classes for all available tools.booleanDefault istrue.protected ObjectinternalGet(String key) keySet()voidvoidputToolProperties(Map<String, Object> props) putToolProperty(String key, Object value) voidputVelocityEngine(org.apache.velocity.app.VelocityEngine engine) Puts the specified VelocityEngine in the tool properties, as well as the Log for that engine.voidsetUserCanOverwriteTools(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.- 参数:
engine- VelocityEngine instance
-
ToolContext
Creates an instance starting with the specified tool properties.- 参数:
toolProps- tools 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.- 参数:
overwrite- flag value
-
getUserCanOverwriteTools
public boolean getUserCanOverwriteTools()Default istrue.- 返回:
- flag value
- 另请参阅:
-
addToolbox
-
getToolbox
Returns aMapof 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.- 返回:
- aggregated toolbox of all available tools
-
getToolClassMap
Gets a map of keys to classes for all available tools. This does not include any data nor any local context values.- 返回:
- aggregated map of all available tools classes
-
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_KEYto false in the tool properties.- 参数:
engine- VelocityEngine instance
-
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
-