org.webmacro.servlet
Class VariableTool

java.lang.Object
  |
  +--org.webmacro.servlet.VariableTool
All Implemented Interfaces:
ContextTool

public class VariableTool
extends java.lang.Object
implements ContextTool

A ContextTool which allows one to snoop information about an object in the active Context.

Author:
Zeljko Trogrlic, Eric B. Ridge (mailto: ebr@tcdi.com)

Constructor Summary
VariableTool()
           
VariableTool(Context newContext)
           
 
Method Summary
 void destroy(java.lang.Object o)
          At the end of processing this method will be called to return the object generated by init(), in case it needs to be recycled or otherwise cleaned up.
 java.lang.Object init(Context c)
          A new tool object will be instantiated per-request by calling this method.
 boolean isDefined(java.lang.Object name)
          Is the specified object name defined in the active Context?
 boolean isInstanceOf(java.lang.Object obj, java.lang.String className)
          Is the specified object, obj, an instance of the specified className?
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VariableTool

public VariableTool()

VariableTool

public VariableTool(Context newContext)
Method Detail

init

public java.lang.Object init(Context c)
                      throws PropertyException
Description copied from interface: ContextTool
A new tool object will be instantiated per-request by calling this method. A ContextTool is effectively a factory used to create objects for use in templates. Some tools may simply return themselves from this method; others may instantiate new objects to hold the per-request state.
Specified by:
init in interface ContextTool

destroy

public void destroy(java.lang.Object o)
Description copied from interface: ContextTool
At the end of processing this method will be called to return the object generated by init(), in case it needs to be recycled or otherwise cleaned up.
Specified by:
destroy in interface ContextTool

isDefined

public boolean isDefined(java.lang.Object name)
Is the specified object name defined in the active Context?

isInstanceOf

public boolean isInstanceOf(java.lang.Object obj,
                            java.lang.String className)
Is the specified object, obj, an instance of the specified className?

If either parameter is null this method returns false.
If className cannot be found, this method returns false.

Parameters:
obj - an Object from your template Context
className - the fully-qualified class name to check