blob: 29c8182857e203c50cf286cb7e2e72f3472d1d37 (
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
|
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
/**
* Test !if() pointcuts
*/
public class E {
public static void main(String []argv) {
new E().run();
}
public void run() {
System.out.println("E.run() executing");
}
}
@Aspect class Azpect {
@Pointcut("!bar()")
public static void foo() {}
@Pointcut("if()") public static boolean bar() { return false; }
@Before("foo() && execution(* E.run(..))") public void beforeAdvice() {
System.out.println("advice running");
}
}
|