public class SimpleCreationalContext extends AbstractCreationalContext
InitializationCallback
s and DestructionCallback
s associated with
the graph being constructed.
This class is relied upon by the SyncBeanManagerImpl
itself and should not generally be used directly.destructionCallbacks, immutableContext, initializationCallbacks, scope, unresolvedProxies, wired
Constructor and Description |
---|
SimpleCreationalContext(boolean immutableContext,
SyncBeanManager beanManager,
Class<? extends Annotation> scope) |
SimpleCreationalContext(SyncBeanManagerImpl beanManager,
Class<? extends Annotation> scopeName) |
Modifier and Type | Method and Description |
---|---|
void |
addProxyReference(Object proxyRef,
Object realRef)
Adds a lookup from a proxy to the actual bean instance that it is proxying.
|
void |
finish()
Called to indicate all beans have been added to the context.
|
<T> T |
getBeanInstance(Class<T> beanType,
Annotation[] qualifiers)
Obtains an instance of the bean within the creational context based on the specified bean type and qualifiers.
|
<T> T |
getInstanceOrNew(BeanProvider<T> callback,
Class<?> beanType,
Annotation[] qualifiers)
Returns the instance of the specified bean of matching type and qualifiers, or if there is no matching bean within
the context, the specified
BeanProvider is called to instantiate and add the bean to the context. |
<T> T |
getSingletonInstanceOrNew(SimpleInjectionContext injectionContext,
BeanProvider<T> callback,
Class<?> beanType,
Annotation[] qualifiers)
Returns the instance of the specified bean of matching type and qualifiers, or if there is no matching bean within
the context, an instance of the bean will be obtained from the
SimpleInjectionContext . |
addBean, addBean, addDestructionCallback, addInitializationCallback, addUnresolvedProxy, destroyContext, fireAllInitCallbacks, getAllCreatedBeanInstances, getAllCreatedBeans, getBeanReference, getWiredOrNew
public SimpleCreationalContext(SyncBeanManagerImpl beanManager, Class<? extends Annotation> scopeName)
public SimpleCreationalContext(boolean immutableContext, SyncBeanManager beanManager, Class<? extends Annotation> scope)
public void addProxyReference(Object proxyRef, Object realRef)
proxyRef
- the reference to the proxy instancerealRef
- the reference to the actual bean instance which the proxy wrapspublic <T> T getInstanceOrNew(BeanProvider<T> callback, Class<?> beanType, Annotation[] qualifiers)
BeanProvider
is called to instantiate and add the bean to the context.T
- the type of the beancallback
- the BeanProvider
to be called in order to instantiate the bean if it is not already
available without he current creational context.beanType
- the type of the beanqualifiers
- the qualifiers for the beangetSingletonInstanceOrNew(org.jboss.errai.ioc.client.SimpleInjectionContext, BeanProvider, Class, java.lang.annotation.Annotation[])
public <T> T getBeanInstance(Class<T> beanType, Annotation[] qualifiers)
T
- the type of the beanbeanType
- the type of the beanqualifiers
- the qualifiers fo the beanpublic <T> T getSingletonInstanceOrNew(SimpleInjectionContext injectionContext, BeanProvider<T> callback, Class<?> beanType, Annotation[] qualifiers)
SimpleInjectionContext
. This method
assumes that the caller knows that the bean is a singleton bean. It is called directly by the
IOC bootstrapping code.
In the event that bean is not available within the SimpleInjectionContext
, the specified
BeanProvider
is invoked and the bean is added to the SimpleInjectionContext
. This
functionality primarily enables proper behavior for singleton producers.T
- the type of the beaninjectionContext
- the SimpleInjectionContext
of the containercallback
- the BeanProvider
to be called in order to instantiate the bean if it is not already
available without he current creational context. * @param beanTypequalifiers
- the qualifiers for the beangetInstanceOrNew(BeanProvider, Class, java.lang.annotation.Annotation[])
public void finish()
Copyright © 2013-2015 JBoss, a division of Red Hat. All Rights Reserved.