[jboss-user] [JBoss AOP] - Re: Dynamic AOP, Inheritance, AdviceBinding, AspectManager

kabir.khan@jboss.com do-not-reply at jboss.com
Mon Jan 8 09:54:53 EST 2007


Ah, I see

We do not differentiate between these two cases, and neither does the jvm.

You could try

  | <prepare expr="field(java.lang.String Super->superField"/>
  | </bind>
  | <bind pointcut="execution(B->new(..))">
  |    <interceptor name="AttachDynamicInterceptor"/>
  | </bind>
  | 

And then in AttachDynamicInterceptor do something like:


  | Object invoke(Invocation inv) throws Throwable{
  |    Object target = obj.invokeNext();
  |    Advised advised = (Advised)target;
  |    InstanceAdvisor ia = advised._getInstanceAdvisor();
  |    ia.insertInterceptor("X", new FieldInterceptor());
  |    
  |    return target;
  | }
  | 
  | 

This is a bit primitive though, since the FieldInterceptor will intercept everything that has been prepared on the new class. AOP 2.0 has more functionality in this area http://jboss.org/jbossBlog/blog/kkhan/2006/10/13/JBoss_AOP_2_0_alpha1_Released.txt

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3999036#3999036

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3999036



More information about the jboss-user mailing list