blob: 5d4414e21c740c43033660df8f910cba008c582f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
public class Two {
public static void main(String[] argv) {
Two a = new Two();
a.m();
a.m();
a.m();
a.m();
}
public void m() {
System.out.println("Method m() running");
}
}
aspect X {
int count = 0;
boolean doit() {
count++;
System.out.println("In instance check method, count="+count+" so doit returns "+((count%2)==0));
return (count%2)==0;
}
before():call(* m(..)) && if(thisAspectInstance.doit()){
System.out.println("In advice()");
}
}
|