blob: 5cb6ca87d5c40b76da9af1c75c26a8b989e84ed4 (
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
enum TraceLevel { NONE, LEVEL1, LEVEL2, LEVEL3 }
@interface Trace {
TraceLevel value() default TraceLevel.NONE;
}
aspect X {
before(): execution(@Trace !@Trace(TraceLevel.NONE) * *(..)) {
System.err.println("tracing "+thisJoinPoint);
}
}
public class ExampleOne {
public static void main(String[] args) {
ExampleOne eOne = new ExampleOne();
eOne.m001();
eOne.m002();
eOne.m003();
eOne.m004();
eOne.m005();
eOne.m006();
eOne.m007();
}
@Trace(TraceLevel.NONE)
public void m001() {}
@Trace(TraceLevel.LEVEL2)
public void m002() {}
@Trace(TraceLevel.LEVEL3)
public void m003() {}
@Trace(TraceLevel.NONE)
public void m004() {}
@Trace(TraceLevel.LEVEL2)
public void m005() {}
@Trace(TraceLevel.NONE)
public void m006() {}
@Trace
public void m007() {}
}
|