[ 
https://issues.apache.org/jira/browse/OWB-1217?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16203538#comment-16203538
 ] 

Arjan Tijms commented on OWB-1217:
----------------------------------

{quote}How would you do since CDI doesnt have annotation instances so you can 
get wrong members if you consider non bindings - which is almost always the 
case? {quote}

Shouldn't it be always possible?

If it are 'real' annotations, the CDI implementation can get the annotation 
from the methods, which it'll get as an instance. If it are 'fake' annotations 
(annotation instances set by the application), it has the annotation instances 
as passed-in by the application. 

For instance, if the application does:

{code:java}
 interceptionFactory
            .configure()
            .filterMethods(am -> am.getJavaMember().getName().equals("persist"))
            .forEach(
                amc -> amc.add(new TransactionLiteral()));
{code}

Then CDI obviously has an instance of the annotation, in this case 
{{TransactionLiteral}}, which implements the (non-binding) attributes.

If the user does:

{code:java}
@Transactional(MANDATORY)
public void someMethod() {
}
{code}

Then the annotation can be obtained via reflection from the {{someMethod}} 
method, giving us an instance as well.

So I think it should work in all cases, shouldn't it? It probably works like 
this in Weld.


> Store interceptor binding annotations in ContextData
> ----------------------------------------------------
>
>                 Key: OWB-1217
>                 URL: https://issues.apache.org/jira/browse/OWB-1217
>             Project: OpenWebBeans
>          Issue Type: New Feature
>          Components: Interceptor and Decorators
>    Affects Versions: 2.0.1
>            Reporter: Arjan Tijms
>
> Unfortunately CDI doesn't give us an easy way to obtain the interceptor 
> binding annotations from an interceptor call. See 
> https://issues.jboss.org/browse/CDI-468
> Weld has a workaround for this that can be used until there's an actual spec 
> compliant solution:
> {code:java}
> Set<Annotation> bindings = (Set<Annotation>) 
> invocationContext.getContextData().get("org.jboss.weld.interceptor.bindings");
> {code}
> It would be great if OWB could do the same.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to