Class InvocationTargetTag

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

    public class InvocationTargetTag
    extends DependencyTag

    A specialized tag handler implementation for defining the target object of a method invocation.

    When a MethodInvocationTag is used in the initializer script of a bean declaration the method is typically invoked on the managed object which is the result of the bean declaration. Using InvocationTargetTag it is possible to define a different target, e.g. another bean defined in the current bean context. A use case would be a factory bean which is called to create objects of a specific type. The following example fragment shows how the tag can be used in an initializer script of a bean declaration:

     <di:bean name="initializer" singleton="false">
       <di:methodInvocation method="create" result="obj">
         <di:param parameterClass="java.lang.String" refName="strConst"/>
         <di:invocationTarget refName="factory"/>
       </di:methodInvocation>
       ...
     </di:bean>
     

    The tag defines no attributes in addition to the ones inherited from its base class. So basically the various options for defining the dependency are available. Refer to the documentation of DependencyTag or ParameterTag. The tag must occur in the body of a MethodInvocationTag.

    Since:
    1.1
    Version:
    $Id: InvocationTargetTag.java 207 2012-02-09 07:30:13Z oheger $
    Author:
    Oliver Heger
    • Constructor Detail

      • InvocationTargetTag

        public InvocationTargetTag()
    • Method Detail

      • doTag

        public void doTag​(org.apache.commons.jelly.XMLOutput output)
                   throws org.apache.commons.jelly.JellyTagException
        This implementation determines the parent tag which must be of type MethodInvocationTag. This tag is passed the dependency defined here.
        Throws:
        org.apache.commons.jelly.JellyTagException