Class ContextualBeanRegistry
- java.lang.Object
-
- com.aspectran.core.component.AbstractComponent
-
- com.aspectran.core.component.bean.ContextualBeanRegistry
-
- All Implemented Interfaces:
BeanRegistry
,Component
public class ContextualBeanRegistry extends AbstractComponent
The Class ContextualBeanRegistry.Created: 2009. 03. 09 PM 23:48:09
-
-
Constructor Summary
Constructors Constructor Description ContextualBeanRegistry(ActivityContext context, BeanRuleRegistry beanRuleRegistry, BeanProxifierType beanProxifierType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsBean(java.lang.Class<?> type)
Return whether a bean with the specified object type is present.boolean
containsBean(java.lang.Class<?> type, java.lang.String id)
boolean
containsBean(java.lang.String id)
Return whether a bean with the specified id is present.protected java.lang.Object
createBean(BeanRule beanRule)
protected java.lang.Object
createBean(BeanRule beanRule, Scope scope)
protected java.lang.Object
createBean(BeanRule beanRule, Scope scope, Activity activity)
void
destroySingleton(java.lang.Object bean)
protected void
doDestroy()
protected void
doInitialize()
java.util.Collection<java.lang.Class<?>>
findConfigBeanClassesWithAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
protected ActivityContext
getActivityContext()
protected <V> V
getBean(BeanRule beanRule)
<V> V
getBean(java.lang.Class<V> type)
Returns the bean instance that uniquely matches the given object type.<V> V
getBean(java.lang.Class<V> type, java.lang.String id)
Returns an instance of the bean that matches the given object type.<V> V
getBean(java.lang.String id)
Returns an instance of the bean that matches the given id.protected BeanRuleRegistry
getBeanRuleRegistry()
<V> V[]
getBeansOfType(java.lang.Class<V> type)
protected java.lang.Object
getFactoryProducedObject(BeanRule beanRule, java.lang.Object bean)
<V> V
getPrototypeScopeBean(BeanRule beanRule)
boolean
hasSingleton(java.lang.Class<?> type)
boolean
hasSingleton(java.lang.Class<?> type, java.lang.String id)
boolean
hasSingleton(java.lang.Object bean)
-
Methods inherited from class com.aspectran.core.component.AbstractComponent
destroy, getComponentName, initialize, isAvailable, isDestroyed, isDestroying, isInitialized
-
-
-
-
Constructor Detail
-
ContextualBeanRegistry
public ContextualBeanRegistry(ActivityContext context, BeanRuleRegistry beanRuleRegistry, BeanProxifierType beanProxifierType)
-
-
Method Detail
-
getBean
public <V> V getBean(@NonNull java.lang.String id)
Description copied from interface:BeanRegistry
Returns an instance of the bean that matches the given id.- Type Parameters:
V
- the result type of the bean- Parameters:
id
- the id of the bean to retrieve- Returns:
- an instance of the bean
-
getBean
public <V> V getBean(@NonNull java.lang.Class<V> type)
Description copied from interface:BeanRegistry
Returns the bean instance that uniquely matches the given object type.- Type Parameters:
V
- the result type of the bean- Parameters:
type
- the type the bean must match; can be an interface or superclass- Returns:
- an instance of the bean
-
getBean
public <V> V getBean(@NonNull java.lang.Class<V> type, @Nullable java.lang.String id)
Description copied from interface:BeanRegistry
Returns an instance of the bean that matches the given object type. If more than one matching bean is found, we pick a bean that matches the given id.- Type Parameters:
V
- the result type of the bean- Parameters:
type
- type the bean must match; can be an interface or superclassid
- the id of the bean to retrieve- Returns:
- an instance of the bean
-
getBeansOfType
public <V> V[] getBeansOfType(@NonNull java.lang.Class<V> type)
-
containsBean
public boolean containsBean(@NonNull java.lang.String id)
Description copied from interface:BeanRegistry
Return whether a bean with the specified id is present.- Parameters:
id
- the id of the bean to query- Returns:
- whether a bean with the specified id is present
-
containsBean
public boolean containsBean(@NonNull java.lang.Class<?> type)
Description copied from interface:BeanRegistry
Return whether a bean with the specified object type is present.- Parameters:
type
- the object type of the bean to query- Returns:
- whether a bean with the specified type is present
-
containsBean
public boolean containsBean(@NonNull java.lang.Class<?> type, @Nullable java.lang.String id)
-
findConfigBeanClassesWithAnnotation
public java.util.Collection<java.lang.Class<?>> findConfigBeanClassesWithAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
-
getBeanRuleRegistry
protected BeanRuleRegistry getBeanRuleRegistry()
-
getBean
protected <V> V getBean(BeanRule beanRule)
-
getPrototypeScopeBean
public <V> V getPrototypeScopeBean(BeanRule beanRule)
- Specified by:
getPrototypeScopeBean
in interfaceBeanRegistry
-
hasSingleton
public boolean hasSingleton(java.lang.Object bean)
- Specified by:
hasSingleton
in interfaceBeanRegistry
-
hasSingleton
public boolean hasSingleton(@NonNull java.lang.Class<?> type)
- Specified by:
hasSingleton
in interfaceBeanRegistry
-
hasSingleton
public boolean hasSingleton(@NonNull java.lang.Class<?> type, @Nullable java.lang.String id)
- Specified by:
hasSingleton
in interfaceBeanRegistry
-
destroySingleton
public void destroySingleton(java.lang.Object bean) throws java.lang.Exception
- Specified by:
destroySingleton
in interfaceBeanRegistry
- Throws:
java.lang.Exception
-
doInitialize
protected void doInitialize() throws java.lang.Exception
- Specified by:
doInitialize
in classAbstractComponent
- Throws:
java.lang.Exception
-
doDestroy
protected void doDestroy() throws java.lang.Exception
- Specified by:
doDestroy
in classAbstractComponent
- Throws:
java.lang.Exception
-
getActivityContext
protected ActivityContext getActivityContext()
-
createBean
protected java.lang.Object createBean(BeanRule beanRule)
-
getFactoryProducedObject
protected java.lang.Object getFactoryProducedObject(BeanRule beanRule, java.lang.Object bean)
-
-