Class 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 Detail

      • InvocationTag

        protected InvocationTag()
        Creates a new instance of InvocationTag.
    • Method Detail

      • getResult

        public String getResult()
        Returns the name of the result variable. This variable can be set if this invocation tag belongs to a ChainedInvocation.
        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 a ChainedInvocation. This base implementation always returns null. Derived classes can overwrite it if they support the source 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 the createInvocation() 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 by doTag() 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 the Invokable object after its creation. This method will add it to the current InvokableSupport object.
        Parameters:
        inv - the Invokable 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