<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial,helvetica,sans-serif;font-size:10pt"><div>No, not intercepted. Interception only occurs on invoking method on bean instance (or proxy).<br></div><div style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"><br>--Gurkan<br><div style="font-family: arial,helvetica,sans-serif; font-size: 10pt;"><font face="Tahoma" size="2"><hr size="1"><b><span style="font-weight: bold;">From:</span></b> Marius Bogoevici &lt;marius.bogoevici@gmail.com&gt;<br><b><span style="font-weight: bold;">To:</span></b> Gavin King &lt;gavin.king@gmail.com&gt;<br><b><span style="font-weight: bold;">Cc:</span></b> Weld-Dev List &lt;weld-dev@lists.jboss.org&gt;<br><b><span style="font-weight: bold;">Sent:</span></b> Thu, April 29, 2010 7:30:55 PM<br><b><span style="font-weight: bold;">Subject:</span></b> [weld-dev] Question for EG, was: Retrieving the Bean object for
 an interceptor<br></font><br>On 10-04-22 1:44 AM, Gavin King wrote:<br>&gt; On Thu, Apr 22, 2010 at 12:38 AM, Marius Bogoevici<br>&gt; &lt;<a ymailto="mailto:marius.bogoevici@gmail.com" href="mailto:marius.bogoevici@gmail.com">marius.bogoevici@gmail.com</a>&gt;&nbsp; wrote:<br>&gt;&nbsp; &nbsp; <br>&gt;&gt; However, once we move to subclassing (1.0.2), the call will<br>&gt;&gt; return the single instrumented instance, which is essentially a subclass<br>&gt;&gt; of the bean class. It would be necessary to retrieve the original bean<br>&gt;&gt; class from that. But I can see a few options for doing that, one being a<br>&gt;&gt; mixin interface with methods that can retrieve information about the<br>&gt;&gt; original type of the target object.<br>&gt;&gt;&nbsp; &nbsp; &nbsp; <br>&gt; Hrm. That's a problem I had not thought of with the subclassing<br>&gt; approach. The assumption in EJB is that getTarget() returns an<br>&gt; unintercepted/undecorated
 reference. Urm.<br>&gt;<br>&gt;&nbsp; &nbsp; <br>Gavin,<br><br>This is not the same issue, but still related to what is <br>decorated/intercepted in CDI. Is it possible to clarify the following <br>from the EG's point of view:<br><br>Consider the following bean:<br><br>class SomeBean<br>{<br><br>&nbsp; &nbsp;  @Binding<br>&nbsp; &nbsp;  void method1() {}<br><br>&nbsp; &nbsp;  @Binding<br>&nbsp; &nbsp;  void method2()<br>&nbsp; &nbsp;  {<br>&nbsp; &nbsp; &nbsp; &nbsp;  method1();<br>&nbsp; &nbsp;  }<br>}<br><br>The question is whether upon invoking method2(), the subsequent <br>invocation to method1() must be intercepted as well.&nbsp; While this hasn't <br>been possible while using proxies, the question becomes actual in the <br>context of subclassing. It has also been raised by users recently.<br><br>The specification says that only business method invocations on <br>contextual references must be intercepted, so the main question here is <br>whether we
 should treat *this* as a contextual reference. While I'm not <br>sold entirely either way, I can see a lot more reasons why <br>this.method1() would not be intercepted upon invoking method2(), the <br>idea being that interceptors/decorators are container-level entities <br>which are applied on the "contextual reference" and not on the POJO bean <br>itself, which would also be consistent with the way things are done in <br>EJB. Also, if we allow interception in this case, then the invocation to <br>method1() would also need to be decorated, which IMO can lead to <br>unexpected side-effects.<br><br>Pete and I have discussed this,&nbsp; and since the current subclassing <br>approach opens the door to an interpretation where method invocations on <br>"this" are also decorated and intercepted, we decided that the best <br>course of action is to address the EG for clarifications. <br>Implementation-wise, it can be done either
 way.<br><br>Thanks,<br>Marius<br><br><br>_______________________________________________<br>weld-dev mailing list<br><a ymailto="mailto:weld-dev@lists.jboss.org" href="mailto:weld-dev@lists.jboss.org">weld-dev@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/weld-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/weld-dev</a><br></div></div>
</div><br></body></html>