Class SetPropertyTag

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

    public class SetPropertyTag
    extends DependencyTag

    A tag handler class that creates a SetPropertyInvocation object.

    This tag is initialized with the name of a property to be set and a Dependency to the property's value. It will then create a SetPropertyInvocation object with this information and add it to the InvokableSupport object found in the current context. The following attributes are supported:

    .
    Attribute Description Optional
    property Defines the name of the property to set. This property must exist in the target class of the invocation. no
    refName Specifies a dependency to another bean. The bean with this name will be fetched and passed to the property setter method. yes
    refClass Specifies a dependency to another bean by its class. The bean with this class will be fetched and passed to the property setter method. yes
    refClassName Specifies a dependency to another bean by its class name. The bean with this class will be fetched and passed to the property setter method. 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 property 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 property value, it may be necessary to perform some type conversion. With this attribute the type of the property 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
    source Defines the name of the local variable, on which this Invokable object is to be executed. This attribute can only be used if a ChainedInvocation is in the current scope. yes

    From all the different ways of defining a dependency exactly one must be used.

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

      • SetPropertyTag

        public SetPropertyTag()
    • Method Detail

      • getProperty

        public String getProperty()
        Returns the name of the property to be set by this tag.
        Returns:
        the property name
      • setProperty

        public void setProperty​(String property)
        Set method of the property attribute.
        Parameters:
        property - the attribute's value
      • getSource

        public String getSource()
        Returns the name of the source variable. This may be used if this tag is used inside an invocation chain.
        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
      • doTag

        public void doTag​(org.apache.commons.jelly.XMLOutput out)
                   throws org.apache.commons.jelly.JellyTagException
        The main method of this tag. Invokes the body and delegates to process().
        Parameters:
        out - the output object
        Throws:
        org.apache.commons.jelly.JellyTagException - in case of an error
      • process

        protected void process()
                        throws org.apache.commons.jelly.JellyTagException
        Executes this tag. This method is invoked by doTag() and does the real work.
        Throws:
        org.apache.commons.jelly.JellyTagException - if an error occurs or the tag is incorrectly used