Generated by
JDiff

com.google.inject.throwingproviders Documentation Differences

This file contains all the changes in documentation in the package com.google.inject.throwingproviders as colored differences. Deletions are shown like this, and additions are shown like this.
If no deletions or additions are shown in an entry, the HTML tags will be what has changed. The new HTML tags are shown in the differences. If no documentation existed, and then some was added in a later version, this change is noted in the appropriate class pages of differences, but the change is not shown on this page. Only changes in existing text are shown here. Similarly, documentation which was inherited from another class or interface is not shown here.
Note that an HTML error in the new documentation may cause the display of other documentation changes to be presented incorrectly. For instance, failure to close a <code> tag will cause all subsequent paragraphs to be displayed differently.

Class CheckedProvides

Annotates methods of a com.google.inject.Module to create aa CheckedProvider method binding that can throw exceptions. TheThe method's return type is bound bound to a CheckedProvider that can bebe injected. Guice will pass pass dependencies to the method as parameters. InstallInstall {@literal @}CheckedProvides CheckedProvides methods by using ThrowingProviderBinder.forModule(com.google.inject.Module) on the module where the methods are declared. @author sameb@google.com (Sam Berlin) @since 3.0

Class ThrowingProviderBinder

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());
   }
   
   {@literal @}CheckedProvides(RemoteProvider.class)
   {@literal @}RequestScope
   Customer provideCustomer(FlakyCustomerCreator creator) throws RemoteException {
     return creator.getCustomerOrThrow();
   }
 }
 
You also can declare that a CheckedProvider construct a particular class whose constructor throws an exception:
ThrowingProviderBinder.create(binder())
    .bind(RemoteProvider.class, Customer.class)
    .providing(CustomerImpl.class)
    .in(RequestScope.class);
 
@author jmourits@google.com (Jerome Mourits) @author jessewilson@google.com (Jesse Wilson) @author sameb@google.com (Sam Berlin)