I'm doing an experiment and I have to map all the classes and its attributes and methods to their respective code in Java. For now I'd like to know what's the best approach to parse a .java file and find which classes there are in those files, as well as their attributes and methods. I've seen in some other topics that building my own lexical analyser is not a good idea, as there're some libraries that already do this hard work. I found that it's possible to do this with files which are already included in the project just by calling some methods in Java, but not from external .java files.
Can anyone light me up? Thanks in advance