Class ParameterTag

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

    public class ParameterTag
    extends DependencyTag

    A tag handler class for defining the parameters of a method or constructor invocation.

    This tag can be placed multiple times in the body of an InvocationTag. Each occurrence defines exactly one parameter of the invocation. A parameter is defined by a dependency (several ways of defining dependencies are supported). Optionally the data type class of the parameter can be provided. (This is recommended because it makes reflection calls more efficient.) The following table shows the attributes supported by this tag:

    .
    Attribute Description Optional
    refName Specifies a dependency to another bean. The bean with this name will be fetched and passed as parameter to the affected invocation. yes
    refClass Specifies a dependency to another bean by its class. The bean with this class will be fetched and passed as parameter to the affected invocation. yes
    refClassName Specifies a dependency to another bean by its class name. The bean with this class will be fetched and passed as parameter to the affected invocation. yes
    refClassLoader With this attribute a symbolic name for the class loader to be used can be specified. It is evaluated only if the refClassName attribute was set. In this case the class loader specified here will be used for resolving the class name. yes
    value If the parameter is to be set to a constant value, this attribute can be used. It allows to directly specify the value. yes
    valueClass If a constant value is to be used for the parameter value, it may be necessary to perform some type conversion. With this attribute the type of the parameter can be specified. The value will then be converted to this type. yes
    valueClassName Like valueClass, but the name of the property's data type class is specified. yes
    valueClassLoader If the data type class of the value is specified by its name only, with this attribute the class loader can be determined for resolving the class. yes
    var If this invocation is part of a ChainedInvocation, it is possible to refer to a local variable of this chain. This is done with this attribute. yes
    parameterClass Defines the data type class of this parameter. When resolving the method to be invoked this data type is used. If it is unspecified, it will be inferred from the type of the parameter value (which might be slightly less efficient). yes
    parameterClassName Like paramClass, but the data type of this parameter is specified by its name. yes
    parameterClassLoader Specifies the class loader for resolving the class of this parameter if it is specified by name. yes

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

      • ParameterTag

        public ParameterTag()
        Creates a new instance of ParameterTag.
    • Method Detail

      • doTag

        public void doTag​(org.apache.commons.jelly.XMLOutput out)
                   throws org.apache.commons.jelly.JellyTagException
        The main method of this tag. Finds the enclosing InvocationTag and delegates to the process() method.
        Parameters:
        out - the output object
        Throws:
        org.apache.commons.jelly.JellyTagException - if an error occurs or the tag is not correctly used
      • getParameterDependency

        public Dependency getParameterDependency()
        Returns the dependency for this parameter. This is basically the definition of the parameter value.
        Returns:
        the dependency of this parameter
      • getParameterClassDesc

        public ClassDescription getParameterClassDesc()
        Returns a ClassDescription object for the data type class of this parameter. This may be null if it was not defined.
        Returns:
        the data type class of this parameter
      • getInvocationTag

        public InvocationTag getInvocationTag()
        Returns a reference to the InvocationTag, to which this tag belongs.
        Returns:
        the enclosing InvocationTag
      • getParameterClassData

        public ClassDescData getParameterClassData()
        Returns the data object for the class description of this parameter.
        Returns:
        the parameter class data
      • setParameterClass

        public void setParameterClass​(Class<?> c)
        Set method of the parameterClass attribute.
        Parameters:
        c - the attribute's value
      • setParameterClassName

        public void setParameterClassName​(String s)
        Set method of the parameterClassName attribute.
        Parameters:
        s - the attribute's value
      • setParameterClassLoader

        public void setParameterClassLoader​(String s)
        Set method of the parameterClassLoader attribute.
        Parameters:
        s - the attribute's value
      • process

        protected void process()
                        throws org.apache.commons.jelly.JellyTagException
        Executes this tag. This implementation will check and evaluate the attributes and add itself to the owning InvocationTag.
        Throws:
        org.apache.commons.jelly.JellyTagException - if the tag is not correctly used
      • initInvocationTag

        protected void initInvocationTag​(InvocationTag invTag)
        Initializes this tag with the reference to the associated InvocationTag. This may be null if the tag is not placed in the body of an InvocationTag (which is normally an error).
        Parameters:
        invTag - the invocation tag