I have a question about reflection I am trying to have some kind of eval() method. So i can call for example:
eval(\"test(\'woohoo\')\");
You can use getMethods()
which returns an array of all methods of a class.
Inside the loop you can inspect the parameters of each method.
for(Method m : cl.getMethods()) {
Class>[] params = m.getParameterTypes();
...
}
Otherwise you can use getDelcaredMethods()
which will allow you to "see" private methods (but not inherited methods). Note that if you want to invoke a private methods you must first apply setAccessible(boolean flag) on it:
for(Method m : cl.getDelcaredMethods()) {
m.setAccessible(true);
Class>[] params = m.getParameterTypes();
...
}