public class SyncBeanManagerImpl extends Object implements SyncBeanManager, SyncBeanManagerSetup
Constructor and Description |
---|
SyncBeanManagerImpl() |
Modifier and Type | Method and Description |
---|---|
void |
addBean(Class<Object> type,
Class<?> beanType,
BeanProvider<Object> callback,
Object instance,
Annotation[] qualifiers)
Register a bean with the manager.
|
void |
addBean(Class<Object> type,
Class<?> beanType,
BeanProvider<Object> callback,
Object instance,
Annotation[] qualifiers,
String name)
Register a bean with the manager with a name.
|
void |
addBean(Class<Object> type,
Class<?> beanType,
BeanProvider<Object> callback,
Object instance,
Annotation[] qualifiers,
String name,
boolean concreteType,
Class<Object> beanActivatorType)
Register a bean with the manager with a name as well as specifying whether the bean should be
treated a concrete type.
|
void |
addBeanToContext(Object ref,
CreationalContext creationalContext)
Associates a bean instance with a creational context.
|
boolean |
addDestructionCallback(Object beanInstance,
DestructionCallback<?> destructionCallback)
Associates a
DestructionCallback with a bean instance. |
void |
addProxyReference(Object proxyRef,
Object realRef)
Associates the reference to a proxied bean to the underlying bean instance which it is proxying.
|
void |
destroyAllBeans()
Destroy all beans currently managed by the bean manager.
|
void |
destroyBean(Object ref)
Destroy a bean and all other beans associated with its creational context in the bean manager.
|
Object |
getActualBeanReference(Object ref)
Obtains an instance to the actual bean.
|
boolean |
isManaged(Object ref)
Indicates whether the referenced object is currently a managed bean.
|
boolean |
isProxyReference(Object ref)
Determines whether the referenced object is itself a proxy to a managed bean.
|
<T> IOCBeanDef<T> |
lookupBean(Class<T> type,
Annotation... qualifiers)
Looks up a bean reference based on type and qualifiers.
|
<T> Collection<IOCBeanDef<T>> |
lookupBeans(Class<T> type)
Looks up all beans of the specified type.
|
<T> Collection<IOCBeanDef<T>> |
lookupBeans(Class<T> type,
Annotation... qualifierInstances)
Looks up a bean reference based on type and qualifiers.
|
Collection<IOCBeanDef> |
lookupBeans(String name)
Looks up all beans with the specified bean name as specified by
Named . |
<T> IOCBeanDef<T> |
registerBean(IOCBeanDef<T> bean)
Register a bean with the manager.
|
public void addBean(Class<Object> type, Class<?> beanType, BeanProvider<Object> callback, Object instance, Annotation[] qualifiers)
SyncBeanManagerSetup
addBean
in interface SyncBeanManagerSetup
type
- the bean typebeanType
- the actual type of the beancallback
- the creational callback used to construct the beaninstance
- the instance referencequalifiers
- any qualifierspublic void addBean(Class<Object> type, Class<?> beanType, BeanProvider<Object> callback, Object instance, Annotation[] qualifiers, String name)
SyncBeanManagerSetup
addBean
in interface SyncBeanManagerSetup
type
- the bean typebeanType
- the actual type of the beancallback
- the creational callback used to construct the beaninstance
- the instance referencequalifiers
- any qualifiersname
- the name of the beanpublic void addBean(Class<Object> type, Class<?> beanType, BeanProvider<Object> callback, Object instance, Annotation[] qualifiers, String name, boolean concreteType, Class<Object> beanActivatorType)
SyncBeanManagerSetup
addBean
in interface SyncBeanManagerSetup
type
- the bean typebeanType
- the actual type of the beancallback
- the creational callback used to construct the beaninstance
- the instance referencequalifiers
- any qualifiersname
- the name of the beanconcreteType
- true if bean should be treated as concrete (ie. not an interface or abstract type).public void destroyBean(Object ref)
ClientBeanManager
destroyBean
in interface ClientBeanManager
ref
- the instance reference of the beanpublic boolean isManaged(Object ref)
ClientBeanManager
isManaged
in interface ClientBeanManager
ref
- the reference to the beanpublic Object getActualBeanReference(Object ref)
ClientBeanManager
getActualBeanReference
in interface ClientBeanManager
ref
- the proxied or unproxied referenceClientBeanManager.isProxyReference(Object)
public boolean isProxyReference(Object ref)
ClientBeanManager
isProxyReference
in interface ClientBeanManager
ref
- the reference to checkClientBeanManager.getActualBeanReference(Object)
public void addProxyReference(Object proxyRef, Object realRef)
ClientBeanManager
addProxyReference
in interface ClientBeanManager
proxyRef
- the reference to the proxyrealRef
- the reference to the bean being proxied.public void addBeanToContext(Object ref, CreationalContext creationalContext)
ClientBeanManager
addBeanToContext
in interface ClientBeanManager
ref
- the reference to the beancreationalContext
- the CreationalContext
instance to associate the bean instance with.public <T> IOCBeanDef<T> registerBean(IOCBeanDef<T> bean)
SyncBeanManager
registerBean
in interface SyncBeanManager
bean
- an IOCSingletonBean
referencepublic Collection<IOCBeanDef> lookupBeans(String name)
SyncBeanManager
Named
.lookupBeans
in interface SyncBeanManager
name
- the name of bean to lookuppublic <T> Collection<IOCBeanDef<T>> lookupBeans(Class<T> type)
SyncBeanManager
lookupBeans
in interface SyncBeanManager
type
- The type of the beanpublic <T> Collection<IOCBeanDef<T>> lookupBeans(Class<T> type, Annotation... qualifierInstances)
SyncBeanManager
lookupBeans
in interface SyncBeanManager
type
- The type of the beanqualifierInstances
- qualifiers to matchpublic <T> IOCBeanDef<T> lookupBean(Class<T> type, Annotation... qualifiers)
SyncBeanManager
lookupBean
in interface SyncBeanManager
T
- The type of the beantype
- The type of the beanqualifiers
- qualifiers to matchIOCSingletonBean
for the matching type and qualifiers.
Throws an IOCResolutionException
if there is a matching type but none of the
qualifiers match or if more than one bean matches.public boolean addDestructionCallback(Object beanInstance, DestructionCallback<?> destructionCallback)
ClientBeanManager
DestructionCallback
with a bean instance. If the bean manager cannot find a valid
CreationalContext
to associate with the bean, or the bean is no longer considered active, the method
returns false. Otherwise, the method returns true, indicating the callback is now registered
and will be called when the bean is destroyed.addDestructionCallback
in interface ClientBeanManager
beanInstance
- the bean instance to associate the callback to.destructionCallback
- the instance of the DestructionCallback
.DestructionCallback
is successfully registered against a valid
CreationalContext
and false if not.public void destroyAllBeans()
ClientBeanManager
destroyAllBeans
in interface ClientBeanManager
Copyright © 2013-2015 JBoss, a division of Red Hat. All Rights Reserved.