类 Toolbox

java.lang.Object
org.apache.velocity.tools.Toolbox
所有已实现的接口:
Serializable

public class Toolbox extends Object implements Serializable

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.

版本:
$Id: Toolbox.java 511959 2007-02-26 19:24:39Z nbubna $
作者:
Nathan Bubna
另请参阅:
  • 字段详细资料

    • KEY

      public static final String KEY
      The key used to place instances in various scopes.
  • 构造器详细资料

  • 方法详细资料

    • cacheData

      protected void cacheData(Map<String,Object> data)
    • getProperties

      public Map<String,Object> getProperties()
    • get

      public Object get(String key)
    • get

      public Object get(String key, String path)
    • get

      public Object get(String key, Map<String,Object> context)
    • get

      public Object get(String key, String path, Map<String,Object> context)
    • getFromCache

      protected Object getFromCache(String key, String path)
    • getFromInfo

      protected Object getFromInfo(String key, String path, Map<String,Object> context)
    • hasPermission

      protected boolean hasPermission(ToolInfo info, String path)
    • getKeys

      public Set<String> getKeys()
    • getToolClassMap

      public Map<String,Class> getToolClassMap()
      Return a new Map link tools' keys to their Classes. 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.
      返回:
      a map of tools classes indexed by key
    • getAll

      public Map<String,Object> getAll(Map<String,Object> context)
    • combine

      public Toolbox combine(Toolbox... toolboxes)
      Returns a new Toolbox that is a combination of this Toolbox with one or more specified Toolboxes. Neither this instance nor those specified are modified.
      参数:
      toolboxes - Toolboxes to combine
      返回:
      the combined toolbox