blob: 1079417fb703c896fd0381045c33f26c9102ee7c (
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
49
50
51
52
53
54
55
56
|
import java.util.Comparator;
import java.util.Set;
import java.util.TreeSet;
import org.aspectj.lang.reflect.*;
public class ReflectBilling {
public static void main(String[] args) {
AjType<Billing> billingType = AjTypeSystem.getAjType(Billing.class);
InterTypeMethodDeclaration[] itdms = billingType.getDeclaredITDMethods();
Set s = new TreeSet(new Comparator<InterTypeMethodDeclaration>() {
public int compare(InterTypeMethodDeclaration m1, InterTypeMethodDeclaration m2) {
if (m1 == m2) return 0;
int vis = (m1.getModifiers() - m2.getModifiers());
if (vis != 0) return vis;
int name = (m1.getName().compareTo(m2.getName()));
if (name != 0) return name;
try {
return (
m1.getTargetType().getJavaClass().getName().compareTo(
m2.getTargetType().getJavaClass().getName())
);
} catch (ClassNotFoundException ex) {
throw new RuntimeException(ex);
}
}
});
for (InterTypeMethodDeclaration itdm : itdms) { s.add(itdm); }
for (Object o : s) { System.out.println(o); }
InterTypeFieldDeclaration[] itdfs = billingType.getDeclaredITDFields();
Set s2 = new TreeSet(new Comparator<InterTypeFieldDeclaration>() {
public int compare(InterTypeFieldDeclaration m1, InterTypeFieldDeclaration m2) {
if (m1 == m2) return 0;
int vis = (m1.getModifiers() - m2.getModifiers());
if (vis != 0) return vis;
int name = (m1.getName().compareTo(m2.getName()));
if (name != 0) return name;
try {
return (
m1.getTargetType().getJavaClass().getName().compareTo(
m2.getTargetType().getJavaClass().getName())
);
} catch (ClassNotFoundException ex) {
throw new RuntimeException(ex);
}
}
});
for (InterTypeFieldDeclaration itdf : itdfs) { s2.add(itdf); }
for (Object o : s2) { System.out.println(o); } }
}
|