The Spring Framework

## org.springframework.beans.factory.config
Class ListFactoryBean

    java.lang.Object
      org.springframework.beans.factory.config.AbstractFactoryBean
          org.springframework.beans.factory.config.ListFactoryBean

All Implemented Interfaces:
  BeanClassLoaderAware, BeanFactoryAware, DisposableBean, FactoryBean, InitializingBean

    public class ListFactoryBean

extends AbstractFactoryBean

Simple factory for shared List instances. Allows for central setup of Lists via the "list" element in XML bean definitions.

Since:
  09.12.2003
Author:
  Juergen Hoeller
See Also:
  `SetFactoryBean`, `MapFactoryBean`

Field Summary

Fields inherited from class org.springframework.beans.factory.config.AbstractFactoryBean
`logger`

Constructor Summary
`ListFactoryBean()`

Method Summary
`protected Object` `createInstance()` Template method that subclasses must override to construct the object returned by this factory.
`Class` `getObjectType()` This abstract method declaration mirrors the method in the FactoryBean interface, for a consistent offering of abstract template methods.
`void` `setSourceList(List sourceList)` Set the source List, typically populated via XML "list" elements.
`void` `setTargetListClass(Class targetListClass)` Set the class to use for the target List.

Methods inherited from class org.springframework.beans.factory.config.AbstractFactoryBean
`afterPropertiesSet, destroy, destroyInstance, getBeanFactory, getBeanTypeConverter, getEarlySingletonInterfaces, getObject, isSingleton, setBeanClassLoader, setBeanFactory, setSingleton`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ListFactoryBean

    public ListFactoryBean()

Method Detail

### setSourceList

    public void setSourceList(List sourceList)

  Set the source List, typically populated via XML "list" elements.

### setTargetListClass

    public void setTargetListClass(Class targetListClass)

  Set the class to use for the target List. Can be populated with a fully qualified class name when defined in a Spring application context.

  Default is a `java.util.ArrayList`.

  See Also:
    `ArrayList`

### getObjectType

    public Class getObjectType()

  Description copied from class: `AbstractFactoryBean`
  This abstract method declaration mirrors the method in the FactoryBean interface, for a consistent offering of abstract template methods.

  Specified by:
    `getObjectType` in interface `FactoryBean`
  Specified by:
    `getObjectType` in class `AbstractFactoryBean`
  Returns:
    the type of object that this FactoryBean creates, or `null` if not known at the time of the call
  See Also:
    `FactoryBean.getObjectType()`

### createInstance

    protected Object createInstance()

  Description copied from class: `AbstractFactoryBean`
  Template method that subclasses must override to construct the object returned by this factory.

  Invoked on initialization of this FactoryBean in case of a singleton; else, on each `AbstractFactoryBean.getObject()` call.

  Specified by:
    `createInstance` in class `AbstractFactoryBean`
  Returns:
    the object returned by this factory
  See Also:
    `AbstractFactoryBean.getObject()`

The Spring Framework

Copyright © 2002-2008 The Spring Framework.