org.apache.velocity.tools.view
Class ViewToolInfo

java.lang.Object
  |
  +--org.apache.velocity.tools.view.ViewToolInfo
All Implemented Interfaces:
ToolInfo
Direct Known Subclasses:
ServletToolInfo

public class ViewToolInfo
extends java.lang.Object
implements ToolInfo

ToolInfo implementation for view tools. New instances are returned for every call to getInstance(obj), and tools that implement ViewTool are initialized with the given object before being returned.

Version:
$Id: ViewToolInfo.java,v 1.3 2003/05/28 00:17:15 nbubna Exp $
Author:
Nathan Bubna

Field Summary
private  java.lang.Class clazz
           
private  boolean initializable
           
private  java.lang.String key
           
 
Constructor Summary
ViewToolInfo(java.lang.String key, java.lang.String classname)
          Constructor.
 
Method Summary
 java.lang.String getClassname()
           
 java.lang.Object getInstance(java.lang.Object initData)
          Returns a new instance of the tool.
 java.lang.String getKey()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

key

private java.lang.String key

clazz

private java.lang.Class clazz

initializable

private boolean initializable
Constructor Detail

ViewToolInfo

public ViewToolInfo(java.lang.String key,
                    java.lang.String classname)
             throws java.lang.Exception
Constructor. If an instance of the tool cannot be created from the classname, it will throw an exception.

Parameters:
key - the context key for the tool
classname - the fully qualified java.lang.Class of the tool
Method Detail

getKey

public java.lang.String getKey()
Specified by:
getKey in interface ToolInfo
Returns:
the context key for the tool

getClassname

public java.lang.String getClassname()
Specified by:
getClassname in interface ToolInfo
Returns:
the fully qualified classname for the tool

getInstance

public java.lang.Object getInstance(java.lang.Object initData)
Returns a new instance of the tool. If the tool implements ViewTool, the new instance will be initialized using the given data.

Specified by:
getInstance in interface ToolInfo
Parameters:
initData - an object that may be used to initialize the instance
Returns:
an instance of the tool


Copyright (c) 2003 Apache Software Foundation