|
ColdSpring 2.0 - Narwhal | ||||
FRAMES |
WEB-INF.cftags.interface coldspring.beans.factory.FactoryBean
public interface FactoryBean
Interface to be implemented by objects used within a BeanFactory which are themselves factories. If a bean implements this interface, it is used as a factory for an object to expose, not directly as a bean instance that will be exposed itself.
NB: A bean that implements this interface cannot be used as a normal bean. A FactoryBean is defined in a bean style, but the object exposed for bean references (getObject() is always the object that it creates.
FactoryBeans can support singletons and prototypes, and can either create objects lazily on demand or eagerly on startup.
This interface is heavily used within the framework itself. It can be used for application components as well; however, this is not common outside of infrastructure code.
NOTE: FactoryBean objects participate in the containing BeanFactory's synchronization of bean creation. There is usually no need for internal synchronization other than for purposes of lazy initialization within the FactoryBean itself (or the like).
Method Summary | |
---|---|
any |
getObject()
Return an instance (possibly shared or independent) of the object managed by this factory |
string |
getObjectType()
Return the type of object that this FactoryBean creates, or an empty string if not known in advance |
boolean |
isSingleton()
Is the object managed by this factory a singleton? That is, will getObject() always return the same object (a reference that can be cached)? NOTE: If a FactoryBean indicates to hold a singleton object, the object returned from getObject() might get cached by the owning BeanFactory |
Methods inherited from class WEB-INF.cftags.interface |
---|
|
Method Detail |
---|
public any getObject()
public string getObjectType()
public boolean isSingleton()
|
ColdSpring 2.0 - Narwhal | ||||
FRAMES |