public class

ThrowingProviderBinder

extends Object
java.lang.Object
   ↳ com.google.inject.throwingproviders.ThrowingProviderBinder

Class Overview

Builds a binding for a CheckedProvider.

You can use a fluent API and custom providers:

ThrowingProviderBinder.create(binder())
    .bind(RemoteProvider.class, Customer.class)
    .to(RemoteCustomerProvider.class)
    .in(RequestScope.class);
 
or, you can use throwing provider methods:
class MyModule extends AbstractModule {
   configure() {
     ThrowingProviderBinder.install(this, binder());
   }
   
   @CheckedProvides(RemoteProvider.class)
   @RequestScope
   Customer provideCustomer(FlakyCustomerCreator creator) throws RemoteException {
     return creator.getCustomerOrThrow();
   }
 }
 

Summary

Nested Classes
class ThrowingProviderBinder.SecondaryBinder<P extends CheckedProvider>  
Public Methods
<P extends CheckedProvider> SecondaryBinder<P> bind(Class<P> interfaceType, Type valueType)
static ThrowingProviderBinder create(Binder binder)
static Module forModule(Module module)
Returns a module that installs @CheckedProvides methods.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public SecondaryBinder<P> bind (Class<P> interfaceType, Type valueType)

public static ThrowingProviderBinder create (Binder binder)

public static Module forModule (Module module)

Returns a module that installs @CheckedProvides methods.