I have the following aspect:
public aspect MyAspect {
before(String val): args(val, ..) &&
call(public * execute(java.lang.String, ..)) {
}
}
And the following classes A and B, A uses B:
class A() {
public void execute(String a) {
B b = new B();
b.execute();
}
}
class B {
public void execute(String a) {
}
}
And I have a test class:
public class TestClass {
public static void main(String[] args) {
A a = new A();
a.execute("someVal");
B b = new B();
b.execute("someVal");
}
}
- In case we call a.execute () , I don't want the execution aspect to be detected again on B.
- On the other hand, when we call b.execute () directly from the test, I want this aspect to catch b.execute ().
How can this be achieved? I tried using cflowbelow (with negation), but that didn't work.
---- edit ----
, java FilterChain.doFilter(..) - . first doFilter ( , ThreadLocal fiter, - ).
,