|
[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
|
+--com.interface21.beans.factory.support.ListableBeanFactoryImpl
Concrete implementation of ListableBeanFactory. Includes convenient methods to populate the factory from a Map and a ResourceBundle, and to add bean defintions one by one.
Can be used as a standalone bean factory, or as a superclass for custom bean factories.
| Field Summary | |
static java.lang.String |
CLASS_KEY
Prefix for the class property of a root bean definition. |
static java.lang.String |
DEFAULT_PREFIX
Prefix for bean definition keys in Maps. |
static java.lang.String |
PARENT_KEY
Reserved "property" to indicate the parent of a child bean definition. |
static java.lang.String |
REF_PREFIX
Prefix before values referencing other beans |
static java.lang.String |
REF_SUFFIX
Property suffix for references to other beans in the current BeanFactory: e.g. owner.dog(ref)=fido. |
static java.lang.String |
SEPARATOR
Separator between bean name and property name. |
static java.lang.String |
SINGLETON_KEY
Special string added to distinguish owner.(singleton)=true Default is true. |
| Fields inherited from class com.interface21.beans.factory.support.AbstractBeanFactory |
defaultParentBean, FACTORY_BEAN_PREFIX, logger |
| Constructor Summary | |
ListableBeanFactoryImpl()
Creates a new ListableBeanFactoryImpl |
|
ListableBeanFactoryImpl(BeanFactory parentBeanFactory)
Creates a new ListableBeanFactoryImpl with the given parent |
|
| Method Summary | |
protected AbstractBeanDefinition |
getBeanDefinition(java.lang.String prototypeName)
This method must be defined by concrete subclasses to implement the Template Method GoF design pattern. |
int |
getBeanDefinitionCount()
Return the number of beans defined in the factory |
java.lang.String[] |
getBeanDefinitionNames()
Return the names of all beans defined in this factory |
java.lang.String[] |
getBeanDefinitionNames(java.lang.Class type)
Note that this method is slow. |
java.lang.String |
getDefaultParentBean()
Return the default parent bean for this bean factory. |
void |
preInstantiateSingletons()
Ensure that even potentially unreferenced singletons are instantiated Subclasses or callers should invoke this if they want this behavior. |
void |
registerBeanDefinition(java.lang.String prototypeName,
AbstractBeanDefinition beanDefinition)
Subclasses or users should call this method to register new bean definitions with this class. |
int |
registerBeanDefinitions(java.util.Map m,
java.lang.String prefix)
Register valid bean definitions in a properties file. |
int |
registerBeanDefinitions(java.util.ResourceBundle rb,
java.lang.String prefix)
Register bean definitions in a ResourceBundle. |
void |
setDefaultParentBean(java.lang.String defaultParentBean)
Set the default parent bean for this bean factory. |
java.lang.String |
toString()
|
| Methods inherited from class com.interface21.beans.factory.support.AbstractBeanFactory |
getAliases, getBean, getBean, getBeanClass, getParentBeanFactory, isSingleton, registerAlias |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.interface21.beans.factory.BeanFactory |
getAliases, getBean, getBean, isSingleton |
| Field Detail |
public static final java.lang.String DEFAULT_PREFIX
public static final java.lang.String CLASS_KEY
public static final java.lang.String SINGLETON_KEY
public static final java.lang.String PARENT_KEY
public static final java.lang.String SEPARATOR
public static final java.lang.String REF_SUFFIX
public static final java.lang.String REF_PREFIX
| Constructor Detail |
public ListableBeanFactoryImpl()
public ListableBeanFactoryImpl(BeanFactory parentBeanFactory)
| Method Detail |
public void setDefaultParentBean(java.lang.String defaultParentBean)
Can be used e.g. for view definition files, to define a parent with common attributes for all views.
public java.lang.String getDefaultParentBean()
public int getBeanDefinitionCount()
ListableBeanFactorygetBeanDefinitionCount in interface ListableBeanFactoryListableBeanFactory.getBeanDefinitionCount()public final java.lang.String[] getBeanDefinitionNames()
ListableBeanFactorygetBeanDefinitionNames in interface ListableBeanFactoryListableBeanFactory.getBeanDefinitionNames()public final java.lang.String[] getBeanDefinitionNames(java.lang.Class type)
getBeanDefinitionNames in interface ListableBeanFactorycom.interface21.beans.factory.ListableBeanFactorytype - class or interface to match
public final void registerBeanDefinition(java.lang.String prototypeName,
AbstractBeanDefinition beanDefinition)
throws BeansException
prototypeName - name of the bean instance to registerbeanDefinition - definition of the bean instance to registerpublic void preInstantiateSingletons()
public final int registerBeanDefinitions(java.util.Map m,
java.lang.String prefix)
throws BeansException
m - Map name -> property (String or Object). Property values
will be strings if coming from a Properties file etc. Property names
(keys) must be strings. Class keys must be Strings.
employee.class=MyClass // special property
//employee.abstract=true // this prototype can't be instantiated directly
employee.group=Insurance Services // real property
employee.usesDialUp=false // default unless overriden
employee.manager(ref)=tony // reference to another prototype defined in the same file
// cyclic and unresolved references will be detected
salesrep.parent=employee
salesrep.department=Sales and Marketing
techie.parent=employee
techie.department=Software Engineering
techie.usesDialUp=true // overridden property
prefix - The match or filter within the keys
in the map: e.g. 'beans.'BeansException - if there is an error trying to register a definition
public final int registerBeanDefinitions(java.util.ResourceBundle rb,
java.lang.String prefix)
throws BeansException
protected final AbstractBeanDefinition getBeanDefinition(java.lang.String prototypeName)
throws NoSuchBeanDefinitionException
AbstractBeanFactorygetBeanDefinition in class AbstractBeanFactoryAbstractBeanFactory.getBeanDefinition(String)public java.lang.String toString()
toString in class java.lang.Object
|
[Deprecated API] | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | CURRENT API | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||