Class ListTag

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

    public class ListTag
    extends CollectionTag

    A specialized CollectionTag implementation for creating lists.

    With this tag handler class list objects can be created that can be passed to other tags supporting a value (the tag can be placed in the body of each tag handler class derived from DependencyTag). Alternatively, the name attribute can be specified; in this case the list bean can be directly queried from the current bean store using this name. The content of the list is defined by ElementTag tags in the body of this tag. It is possible to define the type of the list elements as attributes. Alternatively the ElementTag tags can have a class definition, which will override the one set at this tag.

    The following example fragment shows how this tag can be used to define a list that will be passed as an argument of a constructor invocation:

       <constructor>
         <param>
           <list elementClassName="java.lang.Integer">
             <element value="1"/>
             <element value="2"/>
             <element value="3"/>
           </list>
         </param>
       </constructor>
     

    ListTag supports the following attributes:

    Attribute Description Optional
    name Using this attribute a name for the list bean can be specified. The bean can then be queried from the current bean store by this name. If no name is provided, an anonymous bean is created; in this case the tag must be nested in the body of a DependencyTag. yes
    elementClass Here the class of the elements contained can be specified. When elements are added, the tag will try to convert the objects to this class if necessary. If an ElementTag in the body of this tag defines a value class, this class will be used thus overriding the element class specified at the collection level. If neither the collection tag nor the element tag specifies a class, no type conversion will be performed. yes
    elementClassName This attribute has the same effect as elementClass, but the name of the element class is specified rather than the class object itself. yes
    elementClassLoader If the name of the element class is specified, with this attribute a class loader for resolving the class can be defined. The name specified here will be passed to the current ClassLoaderProvider for obtaining the desired class loader. yes

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

      • ListTag

        public ListTag()
    • Method Detail

      • createBeanProvider

        protected BeanProvider createBeanProvider()
                                           throws org.apache.commons.jelly.JellyTagException
        Creates the bean provider representing the collection managed by this tag. This implementation will create a ListBeanProvider object.
        Specified by:
        createBeanProvider in class AbstractBeanTag
        Returns:
        the bean provider produced by this tag
        Throws:
        org.apache.commons.jelly.JellyTagException - if an error occurs