Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Pointcut on interface rather than on class

Hi,

My object hierarchy is :

   Order            (Interface, with a method "update(...)")
   AuthOrder        (class, implements "Order")
   AuthOrderWithPWPolicy    (class, extends "AuthOrder")
   InternalOrder        (class, extends "AuthOrderWithPWPolicy")


In one of my Aspects, I have defined a pointcut like this :

   [...]
   pointcut updateOrderHook(Map<String,String[]> params) :
       execution(* AuthOrder.update(..)) && args(params);
   [...]



In this case, when method "update()" is invoked on InternalOrder object,
/*then the "code advice", attached to pointcut, is invoked 3 times !!!*/


BUT, if i change my poincut like this :
   [...]
   pointcut updateOrderHook(Map<String,String[]> params) :
       execution(* InternalOrder.update(..)) && args(params);
   [...]

   (Here, the pointcut is settled on final (leaf) object ....)

... then the "code advice" is invoked one time only.
(this is what i want)


So, my question is : how to deal with this ?
Is there any way to control more precisely the pointcuts on interfaces ?

Thanks in advance


Back to the top