[cdi-dev] [JBoss JIRA] (CDI-468) Extend javax.interceptor.InvocationContext

Xavier Dury (Jira) issues at jboss.org
Sun Nov 10 16:16:00 EST 2019


    [ https://issues.jboss.org/browse/CDI-468?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13810405#comment-13810405 ] 

Xavier Dury commented on CDI-468:
---------------------------------

Instead of modifying the {{InvocationContext}}, wouldn't it be possible to inject the interceptors bindings directly as method parameters?

{code}
@Interceptor
@MyBinding
public class MyInterceptor {
    @AroundInvoke
    public Object intercept(InvocationContext context, MyBinding myBinding) { ... }
}
{code}

Bindings could also be injected into fields (after all, annotations are interfaces and can be proxied) with a special {{Qualifier}}.

> Extend javax.interceptor.InvocationContext
> ------------------------------------------
>
>                 Key: CDI-468
>                 URL: https://issues.jboss.org/browse/CDI-468
>             Project: CDI Specification Issues
>          Issue Type: Feature Request
>            Reporter: Arne Limburg
>            Priority: Major
>             Fix For: 2.1 (Discussion)
>
>
> Currently there is no easy way to obtain the interceptor binding annotation for an interceptor call. The interceptor binding annotation is needed to access @Nonbinding attributes and behave accordingly.
> I propose to extend the javax.interceptor.InvocationContext interface with a method
> public Annotation getInterceptorBinding() or
> public <A extends Annotation> A getInterceptorBinding(Class<A> type)
> The @AroundInvoke method of CDI Interceptors may use this extended interface as parameter instead of the original one to obtain the interceptor binding annotation.



--
This message was sent by Atlassian Jira
(v7.13.8#713008)


More information about the cdi-dev mailing list