I am writing a code which gets all the function names, function parameters , return type ,variable names as well as their data types using the reflection API. The problem I am facing is the information related to the variables is limited only to static class variables. I would also like to get the names and data types of the local variables inside different methods as well. If you guys could help me out with it. Thanks a lot...
You don't get static variables only. You can also get instance variables using the clazz.getFields() method.
You however, cannot get local variables declared in methods using reflection. For that you'd need some debugging API and byte code manipulation languages like ASM.
You should try to find reasons not to have to do any of this.
Joined: May 29, 2012
What do you mean when you say some debugging api?
Joined: Mar 17, 2012
Amol Parikh wrote:What do you mean when you say some debugging api?