3

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

public interface A {
  void methodA();
}

public interface B extends A {
  void methodB();
}

public 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?

pb2q
  • 58,613
  • 19
  • 146
  • 147
mR_fr0g
  • 8,462
  • 7
  • 39
  • 54

2 Answers2

2

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

Espen
  • 10,545
  • 5
  • 33
  • 39
1

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

Eugene Kuleshov
  • 31,461
  • 5
  • 66
  • 67