类 ToolboxFactory
java.lang.Object
org.apache.velocity.tools.ToolboxFactory
This class is the central point of action for VelocityTools.
It manages the configured and scoped ToolInfo
and Data
and is meant to stick around for the life of the application.
It works like this:
- Build up your
FactoryConfiguration
(s) - Create a
ToolboxFactory
instance - Pass the configuration to
configure(org.apache.velocity.tools.config.FactoryConfiguration)
- When appropriate for each scope, use
createToolbox(java.lang.String)
to create theToolbox
for that scope and put that toolbox somewhere appropriate to that scope. - When you want a tool, get that
Toolbox
and ask it for the tool you want (e.g.toolbox.get("math")
).
Of course, most users will not have to do any of this
as much of it is handled for them by some combination of
ToolManager
or VelocityView
and a ToolContext
or ViewToolContext
.
NOTE: While you are free to pass in new configuration info
at any time, that data will only affect Toolbox
es created subsequently.
Any previously created toolboxes will have to be re-created and replaced to
reflect the changes to the configuration.
- 版本:
- $Id: ToolboxFactory.java 511959 2007-02-26 19:24:39Z nbubna $
- 作者:
- Nathan Bubna
-
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明protected void
addToolInfo
(String scope, ToolInfo tool) void
configure
(FactoryConfiguration config) createToolbox
(String scope) getData()
getGlobalProperty
(String name) getToolInfo
(String scope) boolean
protected Object
protected void
putGlobalProperties
(Map<String, Object> props) protected void
putProperties
(String scope, Map<String, Object> props)
-
字段详细资料
-
DEFAULT_SCOPE
- 另请参阅:
-
scopedToolInfo
-
scopedProperties
-
data
-
globalProperties
-
-
构造器详细资料
-
ToolboxFactory
public ToolboxFactory()
-
-
方法详细资料
-
configure
-
putData
-
addToolInfo
-
getToolInfo
-
putGlobalProperties
-
putProperties
-
getGlobalProperty
-
getData
-
hasTools
-
createToolbox
-