|
Generated by JDiff |
||||||||
PREV PACKAGE NEXT PACKAGE FRAMES NO FRAMES |
This file contains all the changes in documentation in the packagecom.google.inject.throwingproviders
as colored differences. Deletions are shownlike 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.
Alternative to the Guice com.google.inject.Provider thatthrowsthrows a checked Exception. Users may not inject {@code T} directly.This interface must be extended to use application-specific exception types.
SuchSuch subinterfaces may not define new methods, but may narrow the exception type.public interface RemoteProvider<T> extends CheckedProvider<T> {T get() throws CustomExceptionOne, CustomExceptionTwo; }When this type is bound using ThrowingProviderBinder, the value
returnedreturned orexceptionexception thrown by .get will be scoped. As a consequence, .getwill invoked at mostonceonce within each scope.@since 3.0
Annotates methods of a com.google.inject.Module to createaa CheckedProvider method binding that can throw exceptions.TheThe method's return type is bound to a CheckedProvider that canbebe injected. Guice will pass dependencies to the method as parameters.InstallInstall {@literal @}CheckedProvides methods byusingusing ThrowingProviderBinder.forModule(com.google.inject.Module) onthethe module where the methodsareare declared.@author sameb@google.com (Sam Berlin) @since 3.0
A version of {@literal @}Inject designed for ThrowingProviders.Use by:ThrowingProviderBinder.create(binder()) .bind(RemoteProvider.class, Customer.class) .providing(CustomerImpl.class);
where CustomerImpl has a constructor annotated with ThrowingInject. @author sameb@google.com (Sam Berlin) @since 4.0
Alternative to the Guice com.google.inject.Provider thatthrowsthrows a checked Exception. Users may not inject {@code T} directly.This interface must be extended to use application-specific exception types.
SuchSuch subinterfaces may not define new methods:public interface RemoteProvider<T> extends ThrowingProvider<T, RemoteException> { }When this type is bound using ThrowingProviderBinder, the value
returnedreturned orexceptionexception thrown by .get will be scoped. As a consequence, .getwill invoked at mostonceonce within each scope. @author jmourits@google.com (Jerome Mourits) @author jessewilson@google.com (Jesse Wilson) @deprecated use CheckedProvider instead.
Builds a binding for a CheckedProvider.Class ThrowingProviderBinder, Module forModule(Module)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() { install(ThrowingProviderBinder.
installforModule(this, binder()); }{@literal @}CheckedProvides(RemoteProvider.class) {@literal @}RequestScope Customer provideCustomer(FlakyCustomerCreator creator) throws RemoteException { return creator.getCustomerOrThrow(); } }You also can declare that a CheckedProviderconstructconstruct a particular class whose constructorthrowsthrows 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)
Returns a module that installs {@literal @}CheckedProvides methods.@since 3.0