java.lang.Object | |
↳ | com.google.inject.throwingproviders.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());
}
@CheckedProvides(RemoteProvider.class)
@RequestScope
Customer provideCustomer(FlakyCustomerCreator creator) throws RemoteException {
return creator.getCustomerOrThrow();
}
}
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
ThrowingProviderBinder.SecondaryBinder<P extends CheckedProvider> |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns a module that installs @
CheckedProvides methods. |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Returns a module that installs @CheckedProvides
methods.