blob: 07df21f10f5b4fcae6dfe3ce99d94d415280c521 (
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
28
29
30
31
32
|
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
public class A {
public static void main(String []argv) {
System.out.println("A.main");
}
}
@Aspect
class Azpect {
@Pointcut("if(false)")
public void isFalse() { }
@Pointcut("if(true)")
public void isTrue() { }
@Before("isTrue() && execution(* A.main(..))")
public void beforeTrue() {
System.out.println("Azpect.beforeTrue");
}
@Before("isFalse() && execution(* A.main(..))")
public void beforeFalse() {
System.out.println("Azpect.beforeFalse");
}
}
|