bineanzhou / google-guice

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

Proxy-based interceptors (rather than subclass-based interceptors) #167

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
See
http://groups.google.com/group/google-guice-dev/browse_thread/thread/a48e0e70fc7
33309

Attached is a ProxyProvider class (with unit test).

Usage:

bind(Foo.class).toProvider(
    new ProxyProvider(getProvider(Key.get(Foo.class, Bare.class))
        .bindInterceptor(any(), accessControlInterceptor));

Original issue reported on code.google.com by t.broyer on 23 Nov 2007 at 9:33

Attachments:

GoogleCodeExporter commented 9 years ago
Another try, integrated into Guice "core", attaching interceptors to bindings.

Usage:

bind(Foo.class).to(Key.get(Foo.class, Bare.class))
    .withInterceptor(any(), accessControlInterceptor);

Original comment by t.broyer on 24 Nov 2007 at 12:27

Attachments:

GoogleCodeExporter commented 9 years ago
Oops, hadn't checked the patch against a clean checkout. Here's a fixed patch.

Original comment by t.broyer on 30 Nov 2007 at 9:52

Attachments:

GoogleCodeExporter commented 9 years ago
This could be implemented as an extension, not unlike say assistedinject. I 
think we'll continue to only support 
subclass-based interceptors in core Guice, otherwise things get confusing fast!

Original comment by limpbizkit on 31 Dec 2008 at 12:44

GoogleCodeExporter commented 9 years ago
Jesse's notes in comment #3 summarize the resolution.

Original comment by sberlin on 2 May 2010 at 12:39