类 ToolContext

java.lang.Object
org.apache.velocity.tools.ToolContext
所有已实现的接口:
org.apache.velocity.context.Context
直接已知子类:
ViewToolContext

public class ToolContext extends Object implements 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

      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

      public ToolContext(Map<String,Object> toolProps)
      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 is true. 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 is true.
      另请参阅:
    • addToolbox

      public void addToolbox(Toolbox toolbox)
    • getToolbox

      public Map<String,Object> getToolbox()
      Returns a Map 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

      public Map<String,Class> getToolClassMap()
      Gets a map of keys to classes for all available tools. This does not include any data nor any local context values.
    • getToolboxes

      protected List<Toolbox> getToolboxes()
    • getToolProperties

      protected Map<String,Object> 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 set CATCH_EXCEPTIONS_KEY to false in the tool properties.
    • putToolProperty

      public Object putToolProperty(String key, Object value)
    • putToolProperties

      public void putToolProperties(Map<String,Object> props)
    • put

      public Object put(String key, Object value)
      指定者:
      put 在接口中 org.apache.velocity.context.Context
    • get

      public Object get(String key)
      指定者:
      get 在接口中 org.apache.velocity.context.Context
    • internalGet

      protected Object internalGet(String key)
    • findTool

      protected Object findTool(String key)
    • keySet

      public Set<String> keySet()
    • containsKey

      public boolean containsKey(Object key)
      指定者:
      containsKey 在接口中 org.apache.velocity.context.Context
    • getKeys

      public Object[] getKeys()
      指定者:
      getKeys 在接口中 org.apache.velocity.context.Context
    • remove

      public Object remove(Object key)
      指定者:
      remove 在接口中 org.apache.velocity.context.Context
    • putAll

      public void putAll(Map context)