Repository navigation
Expand file tree
/
Copy pathListClass.java
More file actions
67 lines (53 loc) · 1.6 KB
/
Copy pathListClass.java
File metadata and controls
67 lines (53 loc) · 1.6 KB
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
57
58
59
60
61
62
63
64
65
66
67
import com.sun.javadoc.*;
public class ListClass {
public static boolean start(RootDoc root)
{
ListClass def = new ListClass();
ClassDoc[] classes = root.classes();
System.out.println("[");
for (int i = 0; i < classes.length; ++i) {
if (i > 0)
System.out.println(",");
def.DumpClass(classes[i]);
}
System.out.println("]");
return true;
}
void DumpClass(ClassDoc c)
{
System.out.println("{");
System.out.println("\"name\" : \"" + c.simpleTypeName() + "\", ");
String[] namespaces = c.qualifiedTypeName().split("\\.");
String packageName = "";
for(int i = 0; i < namespaces.length - 1; i++)
{
if (i > 0)
packageName += ".";
packageName += namespaces[i];
}
System.out.println("\"package\" : \"" + c.qualifiedTypeName() + "\", ");
System.out.println("\"props\" : {");
FieldDoc[] f = c.fields();
for (int i = 0; i < f.length; i++)
{
if (i > 0)
System.out.println(",");
System.out.println("\"" + f[i].name()+ "\": \"" + f[i].type().simpleTypeName() + "\"");
}
MethodDoc[] m = c.methods();
for (int i = 0; i < m.length; i++)
{
if (i > 0 || f.length > 0)
System.out.println(",");
System.out.print("\"" + m[i].name() + "(");
for (int j = 0; j < m[i].parameters().length; j++)
{
if (j > 0)
System.out.print(",");
System.out.print(m[i].parameters()[j].name());
}
System.out.println(")\" : \"" + m[i].returnType().simpleTypeName() + "\"");
}
System.out.println("} }");
}
}