Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decorators, that injection point can ask to have applied ad-hoc #96

Closed
gissuebot opened this issue Jul 7, 2014 · 4 comments
Closed

Comments

@gissuebot
Copy link

From kevinb9n on April 24, 2007 17:58:47

Let's say I want to support the following:

  @Inject RemoteService service;

or

  @Inject @ShortTimeout RemoteService service;

Currently this requires two different bindings and some ugly coding.  And
then if you want the short timeout for AnotherRemoteService you do it all
over again.

Instead we could provide a way to independently bind the @ShortTimeout
annotation to a generic decorator such as

  interface Decorator<T> {
    T decorate(T t);
  }
  public class ShortTimeoutDecorator<T> implements Decorator<T> {
    public ShortTimeoutDecorator(Class<T> type, long time, TimeUnit unit) {
      ...
    }
    public T decorate(T t) {
      ...
    }
  }

Now you could just apply that to anything you want.

Original issue: http://code.google.com/p/google-guice/issues/detail?id=96

@gissuebot
Copy link
Author

From limpbizkit on April 26, 2009 23:10:59

Issue 307 has been merged into this issue.

@gissuebot
Copy link
Author

From limpbizkit on April 26, 2009 23:11:34

See issue 307 , including an extension that implements this. http://javaonhorse.googlecode.com/svn/branches/pre-0.1-taowen-spike-2/javaonhorse- auxiliary/src/main/java/com/google/inject/chain/

Status: New

@gissuebot
Copy link
Author

From cvgaviao on January 13, 2010 08:48:32

Hi, will these Chain API be a extension on guice as it is AssistedInject ?

@gissuebot
Copy link
Author

From sberlin on May 02, 2010 05:49:10

It looks like an extension (see comment #2) already implements this.

Status: WontFix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant