com.interface21.beans.factory
Interface FactoryBean

All Known Implementing Classes:
ProxyFactoryBean, AbstractFactoryBean, LocalStatelessSessionProxyFactoryBean, SimpleRemoteStatelessSessionProxyFactoryBean, JndiObjectFactoryBean, LocalSessionFactoryBean, LocalPersistenceManagerFactoryBean, RemoteProxyFactoryBean

public interface FactoryBean

Interface to be implemented by objects used within a BeanFactory that are themselves factories. If a bean implements this interface, it is used as a factory, not directly as a bean.
NB: a bean that implements this interface cannot be used as a normal bean.
FactoryBeans can support singletons and prototypes.

Since:
March 08, 2003
Version:
$Id: FactoryBean.java,v 1.1 2003/03/10 07:38:49 johnsonr Exp $
Author:
Rod Johnson
See Also:
BeanFactory

Method Summary
 java.lang.Object getObject()
          Return an instance (possibly shared or independent) of the object managed by this factory.
 PropertyValues getPropertyValues()
          Property values to pass to new bean instances created by this factory.
 boolean isSingleton()
          Is the bean managed by this factory a singleton or a prototype?
 

Method Detail

getObject

public java.lang.Object getObject()
                           throws BeansException
Return an instance (possibly shared or independent) of the object managed by this factory. As with a BeanFactory, this allows support for both the Singleton and Prototype design pattern.
Returns:
an instance of the bean

isSingleton

public boolean isSingleton()
Is the bean managed by this factory a singleton or a prototype? That is, will getBean() always return the same object?
The singleton status of a FactoryBean will generally be provided by the owning BeanFactory.
Returns:
is this bean a singleton

getPropertyValues

public PropertyValues getPropertyValues()
Property values to pass to new bean instances created by this factory. Mapped directly onto the bean instance using reflection. This occurs after any configuration of the instance performed by the factory itself, and is an optional step within the control of the owning BeanFactory.
Returns:
PropertyValues to pass to each new instance, or null (the default) if there are no properties to pass to the instance.


Rod Johnson and Spring contributors 2001-2003.