Class ConstructorTag

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

    public class ConstructorTag
    extends ConstructorInvocationTag

    A specialized constructor invocation tag that is intended to be used inside a <bean> tag for defining the BeanProvider for creating the managed bean.

    This tag handler class differs from its ancestor in the following ways:

    • It must be a direct child of a <bean> tag.
    • The target class (on which the constructor is to be invoked) need not directly be defined using the tag's attributes. It can also be obtained from the enclosing bean tag.
    • A ConstructorBeanProvider is created and initialized with the also created ConstructorInvocation; this bean provider is then passed to the enclosing bean tag.

    All attributes available for the super class are also supported by this tag handler class.

    Version:
    $Id: ConstructorTag.java 205 2012-01-29 18:29:57Z oheger $
    Author:
    Oliver Heger
    • Constructor Detail

      • ConstructorTag

        public ConstructorTag()
    • Method Detail

      • addInvokable

        public void addInvokable​(Invokable inv)
                          throws org.apache.commons.jelly.JellyTagException
        Adds an Invokable object to this tag. Because this tag registers itself as InvokableSupport, this method will be automatically called by the super class. This makes it possible to obtain the reference to the created ConstructorInvocation.
        Parameters:
        inv - the invocation object to add
        Throws:
        org.apache.commons.jelly.JellyTagException - if the invocation object is not supported or another error occurs
      • getBeanTag

        public BeanTag getBeanTag()
        Returns the enclosing bean tag.
        Returns:
        the enclosing bean tag
      • getTargetClassDescription

        public ClassDescription getTargetClassDescription()
        Returns the target class of the constructor to be invoked. This implementation tries to obtain this information from the bean tag if it is not explicitly set.
        Overrides:
        getTargetClassDescription in class InvocationTag
        Returns:
        the target class
      • doTag

        public void doTag​(org.apache.commons.jelly.XMLOutput out)
                   throws org.apache.commons.jelly.JellyTagException
        The main method if this tag. Tries to obtain the enclosing BeanTag.
        Specified by:
        doTag in interface org.apache.commons.jelly.Tag
        Overrides:
        doTag in class InvocationTag
        Parameters:
        out - the output object
        Throws:
        org.apache.commons.jelly.JellyTagException - if an error occurs
      • setBeanTag

        protected void setBeanTag​(BeanTag tag)
        Initializes the reference to the enclosing BeanTag. For fulfilling its task this tag has to interact with its parent bean tag.
        Parameters:
        tag - the enclosing bean tag
      • process

        protected void process()
                        throws org.apache.commons.jelly.JellyTagException
        Executes this tag.
        Overrides:
        process in class InvocationTag
        Throws:
        org.apache.commons.jelly.JellyTagException - if an error occurs