Errai 3.0.1-SNAPSHOT

org.jboss.errai.ioc.client.container.async
Class AsyncCreationalContext

java.lang.Object
  extended by org.jboss.errai.ioc.client.container.AbstractCreationalContext
      extended by org.jboss.errai.ioc.client.container.async.AsyncCreationalContext
All Implemented Interfaces:
CreationalContext

public class AsyncCreationalContext
extends AbstractCreationalContext

Author:
Mike Brock

Field Summary
 
Fields inherited from class org.jboss.errai.ioc.client.container.AbstractCreationalContext
destructionCallbacks, immutableContext, initializationCallbacks, scope, unresolvedProxies, wired
 
Constructor Summary
AsyncCreationalContext(AsyncBeanManager beanManager, boolean immutableContext, Class<? extends Annotation> scope)
           
AsyncCreationalContext(AsyncBeanManager beanManager, Class<? extends Annotation> scope)
           
 
Method Summary
 void addProxyReference(Object proxyRef, Object realRef)
          Adds a lookup from a proxy to the actual bean instance that it is proxying.
<T> void
addWait(BeanRef beanRef, CreationalCallback<T> callback)
          Add a CreationalCallback to the wait queue.
 void finish(Runnable finishCallback)
           
 AsyncBeanContext getBeanContext()
           
<T> void
getBeanInstance(CreationalCallback<T> creationalCallback, Class<T> beanType, Annotation[] qualifiers)
           
<T> void
getInstanceOrNew(AsyncBeanProvider<T> beanProvider, CreationalCallback<T> creationalCallback, Class<?> beanType, Annotation[] qualifiers)
           
<T> void
getSingletonInstanceOrNew(AsyncInjectionContext injectionContext, AsyncBeanProvider<T> beanProvider, CreationalCallback<T> creationalCallback, Class<T> beanType, Annotation[] qualifiers)
          This method is invoked by generated code (in BootstrapperImpl).
<T> void
getSingletonInstanceOrNew(AsyncInjectionContext injectionContext, AsyncBeanProvider<T> beanProvider, CreationalCallback<T> creationalCallback, Class type, Class<T> beanType, Annotation[] qualifiers, String name)
          Implements the singleton loading logic for beans.
<T> void
notifyAllWaiting(BeanRef beanRef, T instance)
          Notify all waiting callbacks for the instance result from the specified bean provider.
 
Methods inherited from class org.jboss.errai.ioc.client.container.AbstractCreationalContext
addBean, addBean, addDestructionCallback, addInitializationCallback, addUnresolvedProxy, destroyContext, fireAllInitCallbacks, getAllCreatedBeanInstances, getAllCreatedBeans, getBeanReference, getWiredOrNew
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsyncCreationalContext

public AsyncCreationalContext(AsyncBeanManager beanManager,
                              Class<? extends Annotation> scope)

AsyncCreationalContext

public AsyncCreationalContext(AsyncBeanManager beanManager,
                              boolean immutableContext,
                              Class<? extends Annotation> scope)
Method Detail

addProxyReference

public void addProxyReference(Object proxyRef,
                              Object realRef)
Description copied from interface: CreationalContext
Adds a lookup from a proxy to the actual bean instance that it is proxying. This is called directly by the bootstrapping code.

Parameters:
proxyRef - the reference to the proxy instance
realRef - the reference to the actual bean instance which the proxy wraps

getBeanInstance

public <T> void getBeanInstance(CreationalCallback<T> creationalCallback,
                                Class<T> beanType,
                                Annotation[] qualifiers)

addWait

public <T> void addWait(BeanRef beanRef,
                        CreationalCallback<T> callback)
Add a CreationalCallback to the wait queue. Or null to indicate that the first dependency on that bean has begun to load it.

Type Parameters:
T - the type of the bean.
Parameters:
beanRef - the bean reference for the callback.
callback - the instance of the bean.

notifyAllWaiting

public <T> void notifyAllWaiting(BeanRef beanRef,
                                 T instance)
Notify all waiting callbacks for the instance result from the specified bean provider.

Type Parameters:
T - the type of the bean.
Parameters:
beanRef - the bean reference for the callback.
instance - the instance of the bean.

getSingletonInstanceOrNew

public <T> void getSingletonInstanceOrNew(AsyncInjectionContext injectionContext,
                                          AsyncBeanProvider<T> beanProvider,
                                          CreationalCallback<T> creationalCallback,
                                          Class<T> beanType,
                                          Annotation[] qualifiers)
This method is invoked by generated code (in BootstrapperImpl).


getSingletonInstanceOrNew

public <T> void getSingletonInstanceOrNew(AsyncInjectionContext injectionContext,
                                          AsyncBeanProvider<T> beanProvider,
                                          CreationalCallback<T> creationalCallback,
                                          Class type,
                                          Class<T> beanType,
                                          Annotation[] qualifiers,
                                          String name)
Implements the singleton loading logic for beans. Because of the lack of ordering guarantees in asynchronous loading, all attempts to load a reference to a singleton should happen via this method within the bean manager. Within the CreationalContext, calling this method will insure that only one instance of the specified bean is ever created and returned to the specified CreationalCallback.

Type Parameters:
T - the parameterized bean type.
Parameters:
injectionContext - the current AsyncInjectionContext
beanProvider - the reference to the AsyncBeanProvider which is capable of creating a new instance.
creationalCallback - the reference to the CreationalCallback which the instance will be provided to when the bean has finished loading.
beanType - the type of the bean.
qualifiers - the qualifiers for the bean.

getInstanceOrNew

public <T> void getInstanceOrNew(AsyncBeanProvider<T> beanProvider,
                                 CreationalCallback<T> creationalCallback,
                                 Class<?> beanType,
                                 Annotation[] qualifiers)

finish

public void finish(Runnable finishCallback)

getBeanContext

public AsyncBeanContext getBeanContext()

Errai 3.0.1-SNAPSHOT

Copyright © 2013-2014 JBoss, a division of Red Hat. All Rights Reserved.