-
Notifications
You must be signed in to change notification settings - Fork 0
/
JavaClassApiGenerator.java
executable file
·35 lines (33 loc) · 1.09 KB
/
JavaClassApiGenerator.java
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
import java.io.*;
import java.lang.reflect.*;
public class JavaClassApiGenerator {
public static void main(String[] args) throws Exception {
String className;
BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in));
while ((className = stdIn.readLine()) != null) {
ProcessOneClass(className);
}
}
/**
* Process one class.
* @param className: class name.
*/
private static void ProcessOneClass(String className) {
try {
Class klass = Class.forName(className);
if (klass == null) {
return;
}
for (Method method : klass.getDeclaredMethods()) {
System.out.println(klass.getName()
+ " " + method);
}
} catch (ClassNotFoundException e) {
System.out.println("meet ClassNotFoundException: " + e);
} catch (Exception e) {
System.out.println("meet Exception: " + e);
} catch (Error e) {
System.out.println("meet Error: " + e);
}
}
}