com.google.gwt.inject.rebind.binding
Class AsyncProviderBinding

java.lang.Object
  extended by com.google.gwt.inject.rebind.binding.AsyncProviderBinding
All Implemented Interfaces:
Binding

public class AsyncProviderBinding
extends java.lang.Object
implements Binding

Binding implementation for AsyncProvider<T> that generates the following code for the provider:

   return new %provider_name% () {
      public void get(final AsyncCallback<%object_to_create%> callback) {
        GWT.runAsync(new RunAsyncCallback() {
          public void onSuccess() {
            callback.onSuccess(%provider_of_object_to_create%.get());
          }
          public void onFailure(Throwable ex) {
            callback.onFailure(ex);
          }
        }
      }
   }
 
 


Constructor Summary
AsyncProviderBinding(NameGenerator nameGenerator, SourceWriteUtil sourceWriteUtil)
           
 
Method Summary
 RequiredKeys getRequiredKeys()
           
 void setProviderKey(Key<?> providerKey)
           
 void writeCreatorMethods(com.google.gwt.user.rebind.SourceWriter writer, java.lang.String creatorMethodSignature)
          Writes the method necessary to create the binding's type to the writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsyncProviderBinding

@Inject
public AsyncProviderBinding(NameGenerator nameGenerator,
                                   SourceWriteUtil sourceWriteUtil)
Method Detail

setProviderKey

public void setProviderKey(Key<?> providerKey)

writeCreatorMethods

public void writeCreatorMethods(com.google.gwt.user.rebind.SourceWriter writer,
                                java.lang.String creatorMethodSignature)
                         throws NoSourceNameException
Description copied from interface: Binding
Writes the method necessary to create the binding's type to the writer. A method with the creatorMethodSignature must be written, other methods are optional.

Specified by:
writeCreatorMethods in interface Binding
Parameters:
writer - writer that methods are written to
creatorMethodSignature - signature of method that needs to be created
Throws:
NoSourceNameException - if source name is not available for type

getRequiredKeys

public RequiredKeys getRequiredKeys()
Specified by:
getRequiredKeys in interface Binding
Returns:
A tuple of two sets: One set of keys that this binding requires. This set is used to find more classes that need to be bound. The second set contains all keys that have been optionally requested.