On Tue, Apr 13, 2010 at 8:31 PM, Stuart Douglas
<stuart@baileyroberts.com.au> wrote:
I think that the easiest way to address this would be to allow the interceptor to inject the Bean and AnnotatedType object for the intercepted object.
e.g.
@Inject @InterceptedMetadata Bean bean;
@Inject @InterceptedMetadata AnnotatedType type;
In theory the AnnotatedType could be null, but in practice custom beans don't support interceptors, so this should be fine.
This allows the interceptor to read the annotation information from the AnnotatedType. We could also allow beans to inject this information as well, but I think that this can be implemented as a portable extension without any spec changes.
The approach taken by decorators immediately comes to mind. I think the availability of this information would really revolutionize the Java EE approach to interception. I know if I showed this in a presentation I would get some raised brows ;)
-Dan
--