Class InvokeStaticTag
java.lang.Object
org.apache.commons.jelly.TagSupport
org.apache.commons.jelly.tags.core.InvokeStaticTag
- All Implemented Interfaces:
Tag
,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:
- var - The variable to assign the return of the method call to
- method - The name of the static method to invoke
- className - The name of the class containing the static method
- Version:
- $Revision: 155420 $
- Author:
- Robert McIntosh
-
Field Summary
Fields inherited from class org.apache.commons.jelly.TagSupport
body, context, parent
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addArgument
(Class type, Object value) Adds an argument to supply to the methodprotected JellyTagException
Factory method to create a new JellyTagException instance from a given failure exceptionvoid
Evaluates this tag after all the tags properties have been initialized.protected Class
Loads the class using either the class loader which loaded me or the current threads context class loadervoid
setClassName
(String className) Sets the fully qualified class name containing the static methodvoid
setExceptionVar
(String var) Sets the name of a variable that exports the exception thrown by the method's invocation (if any)void
Sets the name of the method to invokevoid
Sets the name of the variable exported by this tagMethods 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
-
Constructor Details
-
InvokeStaticTag
public InvokeStaticTag()
-
-
Method Details
-
setVar
Sets the name of the variable exported by this tag- Parameters:
var
- The variable name
-
setExceptionVar
Sets the name of a variable that exports the exception thrown by the method's invocation (if any) -
setMethod
Sets the name of the method to invoke- Parameters:
methodName
- The method name
-
setClassName
Sets the fully qualified class name containing the static method- Parameters:
className
- The name of the class
-
addArgument
Adds an argument to supply to the method- Specified by:
addArgument
in interfaceArgTagParent
- Parameters:
type
- The Class type of the argumentvalue
- The value of the argument
-
doTag
Description copied from interface:Tag
Evaluates this tag after all the tags properties have been initialized.- Specified by:
doTag
in interfaceTag
- Throws:
JellyTagException
-
loadClass
Loads the class using either the class loader which loaded me or the current threads context class loader- Throws:
ClassNotFoundException
-
createLoadClassFailedException
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
-