Class InvocationTag
- java.lang.Object
-
- org.apache.commons.jelly.TagSupport
-
- net.sf.jguiraffe.gui.builder.di.tags.InvocationTag
-
- All Implemented Interfaces:
org.apache.commons.jelly.Tag
- Direct Known Subclasses:
ConstructorInvocationTag
,MethodInvocationTag
public abstract class InvocationTag extends org.apache.commons.jelly.TagSupport
A base class for tag handler classes defining invocation objects.
This abstract base class provides common functionality for the creation and initialization of invocation objects. It is especially capable of dealing with the parameters of the invocation. Concrete sub classes only have to take care that the correct invocation instance is created, e.g. a method or a constructor invocation.
- Version:
- $Id: InvocationTag.java 205 2012-01-29 18:29:57Z oheger $
- Author:
- Oliver Heger
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
InvocationTag()
Creates a new instance ofInvocationTag
.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addParameter(ParameterTag paramTag)
Adds a parameter to this invocation.protected abstract Invokable
createInvocation()
Creates the invocation object.void
doTag(org.apache.commons.jelly.XMLOutput out)
The main method of this tag.protected Dependency[]
getParameterDependencies()
Returns an array with the dependencies of the this invocation's parameters.protected ClassDescription[]
getParameterTypes()
Returns an array with the data types of the parameters of this invocation.String
getResult()
Returns the name of the result variable.String
getSource()
Returns the name of the source variable.ClassDescData
getTargetClassData()
Returns the target class data object.ClassDescription
getTargetClassDescription()
Returns the class description for the target class of this invocation.protected void
process()
Executes this tag.protected void
processInvokable(Invokable inv)
Processes theInvokable
object after its creation.void
setResult(String result)
Set method of the result attribute.void
setTargetClass(Class<?> c)
Set method of the targetClass attribute.void
setTargetClassLoader(String s)
Set method of the targetClassLoader attribute.void
setTargetClassName(String s)
Set method of the targetClassName attribute.-
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
-
-
-
-
Method Detail
-
getResult
public String getResult()
Returns the name of the result variable. This variable can be set if this invocation tag belongs to aChainedInvocation
.- Returns:
- the name of the result variable
-
setResult
public void setResult(String result)
Set method of the result attribute.- Parameters:
result
- the attribute's value
-
getSource
public String getSource()
Returns the name of the source variable. This variable can be set if this invocation tag belongs to aChainedInvocation
. This base implementation always returns null. Derived classes can overwrite it if they support thesource
attribute.- Returns:
- the name of the source variable
-
getTargetClassData
public ClassDescData getTargetClassData()
Returns the target class data object.- Returns:
- the data object for defining the target class
-
getTargetClassDescription
public ClassDescription getTargetClassDescription()
Returns the class description for the target class of this invocation. Depending on a concrete sub class this description may or may not be required.- Returns:
- the class description for the target class
-
setTargetClass
public void setTargetClass(Class<?> c)
Set method of the targetClass attribute.- Parameters:
c
- the attribute's value
-
setTargetClassName
public void setTargetClassName(String s)
Set method of the targetClassName attribute.- Parameters:
s
- the attribute's value
-
setTargetClassLoader
public void setTargetClassLoader(String s)
Set method of the targetClassLoader attribute.- Parameters:
s
- the attribute's value
-
doTag
public void doTag(org.apache.commons.jelly.XMLOutput out) throws org.apache.commons.jelly.JellyTagException
The main method of this tag. Processes the parameters in the body of this tag and then delegates to thecreateInvocation()
method for actually creating the invocation object.- Parameters:
out
- the output object- Throws:
org.apache.commons.jelly.JellyTagException
- if the tag is incorrectly used or an error occurs
-
addParameter
public void addParameter(ParameterTag paramTag)
Adds a parameter to this invocation. This method is called by parameter tags found in the body of this tag.- Parameters:
paramTag
- the parameter tag to be added
-
process
protected void process() throws org.apache.commons.jelly.JellyTagException
Executes this tag. This method is invoked bydoTag()
after the tag's body has been executed. It does the real work.- Throws:
org.apache.commons.jelly.JellyTagException
- if the tag is incorrectly used or an error occurs
-
processInvokable
protected void processInvokable(Invokable inv) throws org.apache.commons.jelly.JellyTagException
Processes theInvokable
object after its creation. This method will add it to the current
object.InvokableSupport
- Parameters:
inv
- theInvokable
object- Throws:
org.apache.commons.jelly.JellyTagException
- if an error occurs
-
getParameterTypes
protected ClassDescription[] getParameterTypes()
Returns an array with the data types of the parameters of this invocation. This information is probably needed for creating the invocation instance.- Returns:
- an array with the data types of the parameters (some elements may be null if they have not been defined)
-
getParameterDependencies
protected Dependency[] getParameterDependencies()
Returns an array with the dependencies of the this invocation's parameters. This information is probably needed for creating the invocation instance.- Returns:
- an array with the dependencies of the parameters
-
createInvocation
protected abstract Invokable createInvocation() throws org.apache.commons.jelly.JellyTagException
Creates the invocation object. Concrete sub classes must here return the fully initialized invocation object.- Returns:
- the newly created invocation object
- Throws:
org.apache.commons.jelly.JellyTagException
- if an error occurs
-
-