简体   繁体   中英

Eclipse - List all the classes with their methods

I have a java project (in fact, an Android project), and I need to print in a file all the classes and methods that I have in this project.

I've been looking over the web and found the javap tool, which is interested but I don't know how to use it recursively in order to parse all the .java files that I have. Or maybe another tool exists?

What format do you need of this output file?

Eclipse can export the javadoc for your project. These html files will contain all of the classes and their methods.

I believe you can also specify a 'custom doclet' which will allow you to customize the output.

Pseudocode:

  1. Generate a list of files in the bin folder of your project. If you don't know how, use FileUtils from commons-io .
  2. Make sure the file name ends with .class
  3. Remove "bin/" from the path. The resulting string is the name of the class with / instead of . . Replace it with .
  4. Load the class with Class.forName()
  5. Use the Reflection API to get the names of all fields and methods.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM