Class MethodInvocationTag

  • All Implemented Interfaces:
    org.apache.commons.jelly.Tag

    public class MethodInvocationTag
    extends InvocationTag

    A specialized InvocationTag implementation that deals with MethodInvocation 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 a InvocationTargetTag 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 Detail

      • MethodInvocationTag

        public MethodInvocationTag()
    • 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 a ChainedInvocation.
        Overrides:
        getSource in class InvocationTag
        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 a MethodInvocation object.
        Specified by:
        createInvocation in class InvocationTag
        Returns:
        the new invocation object
        Throws:
        org.apache.commons.jelly.JellyTagException - if the tag is incorrectly used