|
[Deprecated API] | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | CURRENT API | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--com.interface21.beans.factory.support.AbstractBeanFactory
Abstract superclass that makes implementing a BeanFactory very easy.
This class uses the Template Method design pattern.
Subclasses must implement only the
getBeanDefinition(name)
method.
This class handles resolution of runtime bean references,
FactoryBean dereferencing, and management of collection properties.
| Field Summary | |
protected java.lang.String |
defaultParentBean
name of default parent bean |
static java.lang.String |
FACTORY_BEAN_PREFIX
Used to dereference a FactoryBean and distinguish it from beans created by the factory. |
protected org.apache.commons.logging.Log |
logger
Logger available to subclasses |
| Constructor Summary | |
AbstractBeanFactory()
Creates a new AbstractBeanFactory |
|
AbstractBeanFactory(BeanFactory parentBeanFactory)
Creates a new AbstractBeanFactory, with the given parent. |
|
| Method Summary | |
java.lang.String[] |
getAliases(java.lang.String name)
Return the aliases for the given bean name, if defined. |
java.lang.Object |
getBean(java.lang.String name)
Return the bean with the given name, checking the parent bean factory if not found. |
java.lang.Object |
getBean(java.lang.String name,
java.lang.Class requiredType)
Return a shared instance of the given bean. |
protected java.lang.Class |
getBeanClass(AbstractBeanDefinition bd)
Convenience method for use by subclasses. |
protected abstract AbstractBeanDefinition |
getBeanDefinition(java.lang.String beanName)
This method must be defined by concrete subclasses to implement the Template Method GoF design pattern. |
BeanFactory |
getParentBeanFactory()
Returns the parent bean factory, or null if none. |
boolean |
isSingleton(java.lang.String name)
Is this bean a singleton? |
void |
registerAlias(java.lang.String name,
java.lang.String alias)
Given a bean name, create an alias. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String FACTORY_BEAN_PREFIX
myEjb is a factory, getting
&myEjb will return the factory, not the instance
returned by the factory.protected final org.apache.commons.logging.Log logger
protected java.lang.String defaultParentBean
| Constructor Detail |
public AbstractBeanFactory()
public AbstractBeanFactory(BeanFactory parentBeanFactory)
parentBeanFactory - the parent bean factory, or null if nonegetBean(java.lang.String)| Method Detail |
public BeanFactory getParentBeanFactory()
public final java.lang.Object getBean(java.lang.String name)
getBean in interface BeanFactoryname - name of the bean to retrieve
public final java.lang.Object getBean(java.lang.String name,
java.lang.Class requiredType)
throws BeansException
getBean in interface BeanFactoryname - name of the instance to returnrequiredType - type the bean must matchBeanNotOfRequiredTypeException - if the bean not of the required typeNoSuchBeanDefinitionException - if there's no such bean definition
public boolean isSingleton(java.lang.String name)
throws NoSuchBeanDefinitionException
BeanFactoryisSingleton in interface BeanFactoryBeanFactory.isSingleton(String)protected final java.lang.Class getBeanClass(AbstractBeanDefinition bd)
bd - the BeanDefinition we want to check. This BeanDefinition
may not actually contain the class--this method may need to navigate
its ancestors to find the class.
public final void registerAlias(java.lang.String name,
java.lang.String alias)
name - name of the beanalias - alias that will behave the same as the bean namespublic final java.lang.String[] getAliases(java.lang.String name)
BeanFactorygetAliases in interface BeanFactorycom.interface21.beans.factory.BeanFactoryname - the bean name to check for aliases
protected abstract AbstractBeanDefinition getBeanDefinition(java.lang.String beanName)
throws NoSuchBeanDefinitionException
beanName - name of the bean to find a definition forNoSuchBeanDefinitionException - if the bean definition cannot be resolved
|
[Deprecated API] | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | CURRENT API | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||