Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void checkMethods(File someFile){
- //Here I want to print the methods in this file
- //here's what I have so far
- String fname = someFile.getClass().getCanonicalName();
- int Mcount = 0;
- try {
- Class cls = Class.forName(fname);
- Method methlist[] = cls.getDeclaredMethods();
- for (int i = 0; i < methlist.length; i++) {
- Method m = methlist[i];
- Mcount = Mcount + 1;
- }
- for (Class clazz = cls ; clazz != null; clazz = clazz.getSuperclass()) {
- System.out.println("Methods for Class" + clazz.getName());
- for (Method m : clazz.getDeclaredMethods()) {
- System.out.println(m);
- }
- }
- } catch (Throwable e) {
- System.err.println(e);
- }
- System.out.println("Mcount = " + Mcount);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement