org.apache.velocity.tools.view
Class ViewToolInfo

java.lang.Object
  extended byorg.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.html,v 1.7.2.1 2004/05/17 17:09:44 nbubna Exp $
Author:
Nathan Bubna

Field Summary
private  java.lang.Class clazz
           
private  boolean initializable
           
private  java.lang.String key
           
 
Constructor Summary
ViewToolInfo()
           
 
Method Summary
protected  java.lang.Class getApplicationClass(java.lang.String name)
          Return the Class object for the specified fully qualified class name, from this web application's class loader.
 java.lang.String getClassname()
           
 java.lang.Object getInstance(java.lang.Object initData)
          Returns a new instance of the tool.
 java.lang.String getKey()
          Accessors
 void setClassname(java.lang.String classname)
          If an instance of the tool cannot be created from the classname passed to this method, it will throw an exception.
 void setKey(java.lang.String key)
          Mutators
 
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()
Method Detail

getApplicationClass

protected java.lang.Class getApplicationClass(java.lang.String name)
                                       throws java.lang.ClassNotFoundException
Return the Class object for the specified fully qualified class name, from this web application's class loader. If no class loader is set for the current thread, then the class loader that loaded this class will be used.

Parameters:
name - Fully qualified class name to be loaded
Returns:
Class object
Throws:
java.lang.ClassNotFoundException - if the class cannot be found
Since:
VelocityTools 1.1

setKey

public void setKey(java.lang.String key)
Mutators


setClassname

public void setClassname(java.lang.String classname)
                  throws java.lang.Exception
If an instance of the tool cannot be created from the classname passed to this method, it will throw an exception.

Parameters:
classname - the fully qualified java.lang.Class of the tool
Throws:
java.lang.Exception

getKey

public java.lang.String getKey()
Accessors

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