org.webmacro.servlet
Class VariableTool

java.lang.Object
  extended byorg.webmacro.ContextTool
      extended byorg.webmacro.servlet.VariableTool
All Implemented Interfaces:
ContextObjectFactory

public class VariableTool
extends 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
 java.lang.Object get(java.lang.Object name)
          Get the specified object name defined from the active Context.
 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 org.webmacro.ContextTool
get
 
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 class: 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 class ContextTool
Throws:
PropertyException

isDefined

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


get

public java.lang.Object get(java.lang.Object name)
Get the specified object name defined from 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


Copyright © 1999-2006 WebMacro. All Rights Reserved.