Search in sources :

Example 1 with GwtDotCreateProvider

use of com.google.gwt.inject.rebind.adapter.GwtDotCreateProvider in project google-gin by gwtplus.

the class GuiceBindingVisitor method visit.

public Void visit(ProviderInstanceBinding<? extends T> providerInstanceBinding) {
    // Detect provider methods and handle them
    // TODO(bstoler): Update this when the SPI explicitly has a case for
    // provider methods
    Provider<? extends T> provider = providerInstanceBinding.getProviderInstance();
    if (provider instanceof ProviderMethod) {
        Context context = Context.forElement(providerInstanceBinding);
        bindingsCollection.addBinding(targetKey, bindingFactory.getProviderMethodBinding((ProviderMethod<?>) provider, context));
        return null;
    }
    if (provider instanceof GwtDotCreateProvider) {
        addImplicitBinding(providerInstanceBinding);
        return null;
    }
    // OTt, use the normal default handler (and error)
    return super.visit(providerInstanceBinding);
}
Also used : Context(com.google.gwt.inject.rebind.binding.Context) GwtDotCreateProvider(com.google.gwt.inject.rebind.adapter.GwtDotCreateProvider) ProviderMethod(com.google.inject.internal.ProviderMethod)

Aggregations

GwtDotCreateProvider (com.google.gwt.inject.rebind.adapter.GwtDotCreateProvider)1 Context (com.google.gwt.inject.rebind.binding.Context)1 ProviderMethod (com.google.inject.internal.ProviderMethod)1