Define a pointcut to capture an interface, but not the parent or auxiliary interfaces

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

public interface A {
  void methodA();
}

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

public interface C extends B {
  void methodC();
}

I need a poincut that only catches method B (), not method A () or methodC (). Is there a way that I can do this in a general way without listing all the sub and super interfaces in a pointcut?

+3
source share
2 answers

Direct inheritance cannot be found using Java or AspectJ.

+2
source

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

+1
source

Source: https://habr.com/ru/post/1746033/


All Articles