I want to read parameters of a class after compilation. I only need the names.
For example:
public class X {
public String y;
...
}
I want to compile the code to a class file. Then have another java project read the names of classes in this case X
and all of class's parameters in this case y
.
Can i do it? If its possible, are the parameters have to be public?
Thanks.
EDIT:
I tried to use JSystem - an automation framework in java. To do it, do I need to read a class file and read all the class names and those parameters? I hope its understandable.
For people who know JSystem, I tried to make JRunner but web gui(with spring).
You want to use java reflection. The following code will give you all classes in a package:
Then to get the properties of a class you can do the following: