[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[aspectj-users] Fwd: trigger all calls/sets from an annotated parameter within a method
|
Hi all,
I'm trying to trigger all calls/sets from an annotated parameter within a method. Consider the following example:
public class A {
public void foo(@MyAnno B b1, B b2){
b1.bar(); //this should trigger
b1.field = 42; //this should trigger
b2.bar(); //should not trigger
b2.field = 42; //should not trigger
}
}
public class B {
public int field;
public void bar() { }
}
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.PARAMETER)
public @interface MyAnno {
}
So far I have the following aspect. But of course this triggers all calls and sets from all method parameters.
@Aspect
public class MyAspect {
@Before("cflowbelow(execution(* *.*(..,@MyAnno (*),..))) && (call(* *(..)) || set(* *)) && !within(MyAspect)")
public void belowAdvice() {
System.out.println("triggered");
}
}
Is there any way to only trigger the calls and sets from the annotated (in my case b1) parameter within a method (foo())?
Thanks in advance!
Fred