google-code-export / google-guice

Automatically exported from code.google.com/p/google-guice
Apache License 2.0
2 stars 1 forks source link

@CheckedProvides #370

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Extends ThrowingProviders to have @Provides-like syntax.

Original issue reported on code.google.com by limpbizkit on 8 May 2009 at 8:36

GoogleCodeExporter commented 9 years ago

Original comment by limpbizkit on 22 Jun 2009 at 2:03

GoogleCodeExporter commented 9 years ago
The attached patch adds some APIs so that you can do:

new AbstractModule() {
  public void configure() {
    ThrowingProviderBinder.install(this, binder());
  }

  @ThrowingProvides(MyThrowingProviderInterface.class)
  Foo foo(Factory dep1, Baz dep2) throws SomeException {
    return dep1.getOrThrowUsing(dep2);
  }
}

Scopes & annotations are fully supported.  A "provides" variation of each test 
was added, and some new tests to make sure that the exceptions in the provider 
method match those in the ThrowingProvider interface.

It also cleans up some bits internally in ThrowingProviderBinder so that it 
uses binder.addError instead of throwing an exception if the ThrowingProvider 
interface isn't compliant.

Original comment by sberlin on 24 Oct 2010 at 4:22

Attachments:

GoogleCodeExporter commented 9 years ago
fixed in r1312.  please review!

Original comment by sberlin on 24 Oct 2010 at 9:37