Class MethodInvocationTag
- java.lang.Object
-
- org.apache.commons.jelly.TagSupport
-
- net.sf.jguiraffe.gui.builder.di.tags.InvocationTag
-
- net.sf.jguiraffe.gui.builder.di.tags.MethodInvocationTag
-
- All Implemented Interfaces:
org.apache.commons.jelly.Tag
public class MethodInvocationTag extends InvocationTag
A specialized
InvocationTag
implementation that deals withMethodInvocation
objects.The following attributes are supported by this tag handler class:
Attribute Description Optional method The name of the method that is to be invoked. no static This boolean attribute determines whether a static method is to be invoked. The default value is false. no targetClass Defines the target class (i.e. the class, to which the method belongs). This information is required only if a static method is to be invoked. yes targetClassName Like targetClass
, but defines the target class by name.yes targetClassLoader If the target class is defined by name, this attribute can be used for determining the class loader to be used for resolving the class name. yes source If this invocation belongs to a ChainedInvocation
, with this attribute the name of the source variable (i.e. the object, on which to invoke the method) can be defined.yes result If this invocation belongs to a ChainedInvocation
, with this attribute the name of the source variable (i.e. the variable, in which the result of this invocation is stored) can be defined.yes In the body of this tag an arbitrary number of
ParameterTag
tags can be placed for defining the parameters of this invocation. Also aInvocationTargetTag
can be used to define a specific target dependency.- Version:
- $Id: MethodInvocationTag.java 207 2012-02-09 07:30:13Z oheger $
- Author:
- Oliver Heger
-
-
Constructor Summary
Constructors Constructor Description MethodInvocationTag()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Invokable
createInvocation()
Creates the invocation object.String
getMethod()
Returns the name of the method to be invoked.String
getSource()
Returns the name of the source variable.Dependency
getTargetDependency()
Returns the target dependency of this method invocation.boolean
isStatic()
Returns a flag whether a static method is to be invoked.void
setMethod(String method)
Set method of the method attribute.void
setSource(String source)
Set method of the source attribute.void
setStatic(boolean f)
Set method of the static attribute.void
setTargetDependency(Dependency targetDependency)
Sets the target dependency of this method invocation.-
Methods inherited from class net.sf.jguiraffe.gui.builder.di.tags.InvocationTag
addParameter, doTag, getParameterDependencies, getParameterTypes, getResult, getTargetClassData, getTargetClassDescription, process, processInvokable, setResult, setTargetClass, setTargetClassLoader, setTargetClassName
-
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
-
getMethod
public String getMethod()
Returns the name of the method to be invoked.- Returns:
- then method name
-
setMethod
public void setMethod(String method)
Set method of the method attribute.- Parameters:
method
- 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
.- Overrides:
getSource
in classInvocationTag
- Returns:
- the name of the source variable
-
setSource
public void setSource(String source)
Set method of the source attribute.- Parameters:
source
- the attribute's value
-
isStatic
public boolean isStatic()
Returns a flag whether a static method is to be invoked.- Returns:
- the static invocation flag
-
setStatic
public void setStatic(boolean f)
Set method of the static attribute.- Parameters:
f
- the attribute's value
-
getTargetDependency
public Dependency getTargetDependency()
Returns the target dependency of this method invocation.- Returns:
- the target dependency (may be null)
- Since:
- 1.1
-
setTargetDependency
public void setTargetDependency(Dependency targetDependency)
Sets the target dependency of this method invocation. This dependency is typically set by tags in the body which select an alternative target object.- Parameters:
targetDependency
- the target dependency- Since:
- 1.1
-
createInvocation
protected Invokable createInvocation() throws org.apache.commons.jelly.JellyTagException
Creates the invocation object. This implementation creates aMethodInvocation
object.- Specified by:
createInvocation
in classInvocationTag
- Returns:
- the new invocation object
- Throws:
org.apache.commons.jelly.JellyTagException
- if the tag is incorrectly used
-
-