You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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
@
ShortTimeoutannotation 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
The text was updated successfully, but these errors were encountered: