views:

93

answers:

2

I was wondering how to define a pointcut in aspecJ the captures any method of an interface but not the methods of any parent or sub interface.

pubic interface A {
  void methodA();
}
pubic interface B extends A {
  void methodB();
}
pubic interface C extends B {
  void methodC();
}

I would like a poincut that only catches methodB() and not methodA() or methodC(). Is there any way i can do this in a general way without listing all the sub and super interfaces in the pointcut?

A: 

Have you tried B.methodB(..) or B+.methodB(..) or even B+.*(..) AspectJ method patterns?

Eugene Kuleshov
+1  A: 

To find direct inheritance is not possible with Java or AspectJ.

Espen