Get the list of packages, classes in packages and methods in class
Joined: Feb 03, 2005
I am working on a code generation project with Velocity. In order to use as parameters, I have to get the list of packages, classes in packages and methods in classes and put them into different array lists. Is there any built-in libraries or java methods for these operation?
A guy from Turkey<br /><a href="http://blogspot.serkandemir.com" target="_blank" rel="nofollow">http://blogspot.serkandemir.com</a>
java.lang.Class can, indeed, tell you the methods in a class; but the only way to get a list of packages or a list of classes in a package is by examining the class path and searching for .class files both in and out of JAR files along that class path. This is a bit easier if you can limit the scope of your query to the classes loaded by a custom classloader that you created yourself, so you know exactly where it's searching.
This is not even close to a "Beginner" topic, so I'm going to move this to Java in General (Intermediate).