blob: 044966200583fcfb968e07a4fcdcbfd3e192a4cb (
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
|
import org.aspectj.lang.annotation.*;
import java.lang.annotation.*;
import java.lang.reflect.*;
@Aspect("perthis(transactional())")
public class Code {
@Pointcut("execution(@Transactional * * (..))")
public void transactional() { }
public static void main(String[] args) {
print(AAA.class);
print(BBB.class);
print(CCC.class);
}
public static void print(Class clazz) {
System.out.println(clazz.getName());
Class[] ifs = clazz.getInterfaces();
if (ifs!=null) {
for (int i=0;i<ifs.length;i++) {
System.out.println(ifs[i]);
}
}
Field[] fs = clazz.getDeclaredFields();
if (fs!=null) {
for (int i=0;i<fs.length;i++) {
System.out.println(fs[i]);
}
}
}
}
class AAA {
public void m() { }
}
class BBB {
public void m() { }
}
class CCC {
@Transactional
public void m() { }
}
@Retention(RetentionPolicy.RUNTIME) @interface Transactional {}
|