org.springframework.config.java
Class DummyFactory

java.lang.Object
  extended by org.springframework.config.java.DummyFactory
All Implemented Interfaces:
BeanFactoryAware, BeanNameAware, DisposableBean, FactoryBean, InitializingBean

public class DummyFactory
extends Object
implements FactoryBean, BeanNameAware, BeanFactoryAware, InitializingBean, DisposableBean

Simple factory to allow testing of FactoryBean support in AbstractBeanFactory. Depending on whether its singleton property is set, it will return a singleton or a prototype instance.

Implements InitializingBean interface, so we can check that factories get this lifecycle callback if they want.

Since:
10.03.2003
Author:
Rod Johnson

Field Summary
static String SINGLETON_NAME
           
 
Constructor Summary
DummyFactory()
           
 
Method Summary
 void afterPropertiesSet()
           
 void destroy()
           
 BeanFactory getBeanFactory()
           
 String getBeanName()
           
 Object getObject()
          Return the managed object, supporting both singleton and prototype mode.
 Class<?> getObjectType()
           
 TestBean getOtherTestBean()
           
 boolean isPostProcessed()
           
 boolean isSingleton()
          Return if the bean managed by this factory is a singleton.
static void reset()
          Clear static state.
 void setBeanFactory(BeanFactory beanFactory)
           
 void setBeanName(String beanName)
           
 void setOtherTestBean(TestBean otherTestBean)
           
 void setPostProcessed(boolean postProcessed)
           
 void setSingleton(boolean singleton)
          Set if the bean managed by this factory is a singleton.
 boolean wasInitialized()
          Was this initialized by invocation of the afterPropertiesSet() method from the InitializingBean interface?
static boolean wasPrototypeCreated()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SINGLETON_NAME

public static final String SINGLETON_NAME
See Also:
Constant Field Values
Constructor Detail

DummyFactory

public DummyFactory()
Method Detail

reset

public static void reset()
Clear static state.


isSingleton

public boolean isSingleton()
Return if the bean managed by this factory is a singleton.

Specified by:
isSingleton in interface FactoryBean
See Also:
org.springframework.config.java.context.java.beans.factory.FactoryBean#isSingleton()

setSingleton

public void setSingleton(boolean singleton)
Set if the bean managed by this factory is a singleton.


setBeanName

public void setBeanName(String beanName)
Specified by:
setBeanName in interface BeanNameAware

getBeanName

public String getBeanName()

setBeanFactory

public void setBeanFactory(BeanFactory beanFactory)
Specified by:
setBeanFactory in interface BeanFactoryAware

getBeanFactory

public BeanFactory getBeanFactory()

setPostProcessed

public void setPostProcessed(boolean postProcessed)

isPostProcessed

public boolean isPostProcessed()

setOtherTestBean

public void setOtherTestBean(TestBean otherTestBean)

getOtherTestBean

public TestBean getOtherTestBean()

afterPropertiesSet

public void afterPropertiesSet()
Specified by:
afterPropertiesSet in interface InitializingBean

wasInitialized

public boolean wasInitialized()
Was this initialized by invocation of the afterPropertiesSet() method from the InitializingBean interface?


wasPrototypeCreated

public static boolean wasPrototypeCreated()

getObject

public Object getObject()
                 throws BeansException
Return the managed object, supporting both singleton and prototype mode.

Specified by:
getObject in interface FactoryBean
Throws:
BeansException
See Also:
org.springframework.config.java.context.java.beans.factory.FactoryBean#getObject()

getObjectType

public Class<?> getObjectType()
Specified by:
getObjectType in interface FactoryBean

destroy

public void destroy()
Specified by:
destroy in interface DisposableBean


Copyright ? 2005-2008 Spring Framework. All Rights Reserved.