[weld-dev] Question for EG, was: Retrieving the Bean object for an interceptor

Gurkan Erdogdu gurkanerdogdu at yahoo.com
Fri Apr 30 01:35:22 EDT 2010


No, not intercepted. Interception only occurs on invoking method on bean instance (or proxy).


--Gurkan


________________________________
From: Marius Bogoevici <marius.bogoevici at gmail.com>
To: Gavin King <gavin.king at gmail.com>
Cc: Weld-Dev List <weld-dev at lists.jboss.org>
Sent: Thu, April 29, 2010 7:30:55 PM
Subject: [weld-dev] Question for EG, was: Retrieving the Bean object for an interceptor

On 10-04-22 1:44 AM, Gavin King wrote:
> On Thu, Apr 22, 2010 at 12:38 AM, Marius Bogoevici
> <marius.bogoevici at gmail.com>  wrote:
>    
>> However, once we move to subclassing (1.0.2), the call will
>> return the single instrumented instance, which is essentially a subclass
>> of the bean class. It would be necessary to retrieve the original bean
>> class from that. But I can see a few options for doing that, one being a
>> mixin interface with methods that can retrieve information about the
>> original type of the target object.
>>      
> Hrm. That's a problem I had not thought of with the subclassing
> approach. The assumption in EJB is that getTarget() returns an
> unintercepted/undecorated reference. Urm.
>
>    
Gavin,

This is not the same issue, but still related to what is 
decorated/intercepted in CDI. Is it possible to clarify the following 
from the EG's point of view:

Consider the following bean:

class SomeBean
{

     @Binding
     void method1() {}

     @Binding
     void method2()
     {
         method1();
     }
}

The question is whether upon invoking method2(), the subsequent 
invocation to method1() must be intercepted as well.  While this hasn't 
been possible while using proxies, the question becomes actual in the 
context of subclassing. It has also been raised by users recently.

The specification says that only business method invocations on 
contextual references must be intercepted, so the main question here is 
whether we should treat *this* as a contextual reference. While I'm not 
sold entirely either way, I can see a lot more reasons why 
this.method1() would not be intercepted upon invoking method2(), the 
idea being that interceptors/decorators are container-level entities 
which are applied on the "contextual reference" and not on the POJO bean 
itself, which would also be consistent with the way things are done in 
EJB. Also, if we allow interception in this case, then the invocation to 
method1() would also need to be decorated, which IMO can lead to 
unexpected side-effects.

Pete and I have discussed this,  and since the current subclassing 
approach opens the door to an interpretation where method invocations on 
"this" are also decorated and intercepted, we decided that the best 
course of action is to address the EG for clarifications. 
Implementation-wise, it can be done either way.

Thanks,
Marius


_______________________________________________
weld-dev mailing list
weld-dev at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/weld-dev


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/weld-dev/attachments/20100429/24c768ef/attachment-0001.html 


More information about the weld-dev mailing list