Nice! I'd like to point out that while you lose interceptor bindings (declared on the instance's class) when using an interface on the InterceptionFactory, you still retain the possibility to parameterize the InterceptionFactory with the target instance's class (and not losing anything). This makes me think that all interceptor bindings could maybe come from the parameter type (+ configurator) and the proxyability requirement could also be on that parameter type rather than on the instance's type... but that would be a change in the current spec. After all, a producer method returning an interface does not seem to take into account the concrete type of the returned object (nor all other interfaces it might implement). This can be tweaked with @Typed. Alternatively and thinking out loud, we could maybe control what type(s) a proxy should be made of with something like this:
@Produces |
SomeInterface bean(@Typed({SomeInterface.class, SomeOtherInterface.class}) InterceptionFactory<SomeInterface> factory) { ... }
|
or with a new method on InterceptionFactory like setProxyTypes(Class<?>...)... but these are just ideas thrown in there. |