public class BeanConfigurationsBeansCollector extends java.lang.Object implements BeansCollector, BeansProvider
BeanConfigurationsBeansCollector collects the beans defined by BeanConfigurations in a
BeanRegistry.
The BeanConfigurationsBeansCollector also implements the BeansProvider-interface by providing the
beans that are already registered in the BeanRegistry. In addition the
BeanConfigurationsBeansCollector may process further BeanConfigurations to fulfill bean-lookups for
beans that are not present yet.
| Modifier and Type | Method and Description |
|---|---|
void |
defineBean(java.lang.Object bean)
Callback-method for
BeanConfigurations to define their beans. |
void |
defineBean(java.lang.String name,
java.lang.Object bean)
Callback-method for
BeanConfigurations to define their beans with an explicit name. |
<T> T |
lookUpBean(java.lang.Class<T> type)
Looks up a bean of the given type.
|
<T> T |
lookUpBean(java.lang.String name,
java.lang.Class<T> type)
Looks up the bean with the given name and type.
|
<T> java.util.List<T> |
lookUpBeans(java.lang.Class<T> type)
Looks up all beans of the given type in the
BeanRegistry of this application. |
void |
registerBeanPostProcessor(BeanPostProcessor beanPostProcessor)
Registers the given
BeanPostProcessor at the underlying BeanRegistry. |
public void defineBean(java.lang.Object bean)
BeanConfigurations to define their beans.defineBean in interface BeansCollectorbean - the beanpublic void defineBean(java.lang.String name,
java.lang.Object bean)
BeanConfigurations to define their beans with an explicit name.
Defining a bean with an explicit name allows to override a bean with the same name. Additionally defining an explicit name can speed-up the lookup of the bean if the lookup is done by name.
defineBean in interface BeansCollectorname - the name of the beanbean - the beanpublic void registerBeanPostProcessor(BeanPostProcessor beanPostProcessor)
BeanPostProcessor at the underlying BeanRegistry.registerBeanPostProcessor in interface BeansCollectorbeanPostProcessor - the new BeanPostProcessorBeanRegistry.registerBeanPostProcessor(BeanPostProcessor)public <T> T lookUpBean(java.lang.String name,
java.lang.Class<T> type)
If no bean with that name is registered or the registered bean is not assignable to the required type,
null is returned.
In order to find the bean, the BeanConfigurationsBeansCollector will attempt to collect more beans from
remaining ready BeanConfigurations first.
lookUpBean in interface BeansProviderT - the bean-typename - the name of the desired beantype - the type of the desired beannullpublic <T> T lookUpBean(java.lang.Class<T> type)
If no bean is assignable to the required type, null is returned. If multiple beans are assignable to the
required type, the first match is returned.
In order to find the bean, the BeanConfigurationsBeansCollector will attempt to collect more beans from
remaining ready BeanConfigurations first.
lookUpBean in interface BeansProviderT - the bean-typetype - the type of the desired beannullpublic <T> java.util.List<T> lookUpBeans(java.lang.Class<T> type)
BeanRegistry of this application.
In order to find all beans, the BeanConfigurationsBeansCollector will attempt to collect more beans from
remaining ready BeanConfigurations first.
lookUpBeans in interface BeansProviderT - the bean-typetype - the type of the desired beans