org.apache.commons.jelly.tags.core
Class InvokeStaticTag

java.lang.Object
  extended by org.apache.commons.jelly.TagSupport
      extended by org.apache.commons.jelly.tags.core.InvokeStaticTag
All Implemented Interfaces:
Tag, ArgTagParent

public class InvokeStaticTag
extends TagSupport
implements ArgTagParent

A Tag which can invoke a static method on a class, without an instance of the class being needed.

Like the InvokeTag, this tag can take a set of arguments using the ArgTag.

The following attributes are required:

Version:
$Revision: 1807798 $
Author:
Field Summary
private  java.lang.String className
          the object to invoke the method on
private  java.lang.String exceptionVar
          the variable where the method's exception is exported
private  java.lang.String methodName
          the method to invoke
private  java.util.List paramTypes
           
private  java.util.List paramValues
           
private  java.lang.String var
          the variable exported
 
Fields inherited from class org.apache.commons.jelly.TagSupport
body, context, hasTrimmed, parent, shouldTrim
 
Constructor Summary
InvokeStaticTag()
           
 
Method Summary
 void addArgument(java.lang.Class type, java.lang.Object value)
          Adds an argument to supply to the method
protected  JellyTagException createLoadClassFailedException(java.lang.Exception e)
          Factory method to create a new JellyTagException instance from a given failure exception
 void doTag(XMLOutput output)
          Evaluates this tag after all the tags properties have been initialized.
protected  java.lang.Class loadClass()
          Loads the class using either the class loader which loaded me or the current threads context class loader
 void setClassName(java.lang.String className)
          Sets the fully qualified class name containing the static method
 void setExceptionVar(java.lang.String var)
          Sets the name of a variable that exports the exception thrown by the method's invocation (if any)
 void setMethod(java.lang.String methodName)
          Sets the name of the method to invoke
 void setVar(java.lang.String var)
          Sets the name of the variable exported by this tag
 
Methods inherited from class org.apache.commons.jelly.TagSupport
findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, getBody, getBodyText, getBodyText, getContext, getParent, invokeBody, isEscapeText, isTrim, setBody, setContext, setEscapeText, setParent, setTrim, trimBody
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

var

private java.lang.String var
the variable exported


exceptionVar

private java.lang.String exceptionVar
the variable where the method's exception is exported


methodName

private java.lang.String methodName
the method to invoke


className

private java.lang.String className
the object to invoke the method on


paramTypes

private java.util.List paramTypes

paramValues

private java.util.List paramValues
Constructor Detail

InvokeStaticTag

public InvokeStaticTag()
Method Detail

setVar

public void setVar(java.lang.String var)
Sets the name of the variable exported by this tag

Parameters:
var - The variable name

setExceptionVar

public void setExceptionVar(java.lang.String var)
Sets the name of a variable that exports the exception thrown by the method's invocation (if any)


setMethod

public void setMethod(java.lang.String methodName)
Sets the name of the method to invoke

Parameters:
method - The method name

setClassName

public void setClassName(java.lang.String className)
Sets the fully qualified class name containing the static method

Parameters:
className - The name of the class

addArgument

public void addArgument(java.lang.Class type,
                        java.lang.Object value)
Adds an argument to supply to the method

Specified by:
addArgument in interface ArgTagParent
Parameters:
type - The Class type of the argument
value - The value of the argument

doTag

public void doTag(XMLOutput output)
           throws JellyTagException
Description copied from interface: Tag
Evaluates this tag after all the tags properties have been initialized.

Specified by:
doTag in interface Tag
Throws:
JellyTagException

loadClass

protected java.lang.Class loadClass()
                             throws java.lang.ClassNotFoundException
Loads the class using either the class loader which loaded me or the current threads context class loader

Throws:
java.lang.ClassNotFoundException

createLoadClassFailedException

protected JellyTagException createLoadClassFailedException(java.lang.Exception e)
Factory method to create a new JellyTagException instance from a given failure exception

Parameters:
e - is the exception which occurred attempting to load the class
Returns:
JellyTagException