I have some Groovy class, for example:
class Apple {
public void methodA(String myParam) {}
public void methodB(String myParam2, String myParam3) {}
}
And I want to print all methods of class Apple in convenient format, for example:
Class Apple:
- methodA <String: myParam>
- methodB <String: myParam2> <String: myParam3>
or just:
Class Apple:
- methodA <myParam>
- methodB <myParam2> <myParam3>
Is it possible in Groovy?
For now I'm using for-each loop for Apple.metaClass.methods and printing method.name, for example:
for (MetaMethod metaMethod in Apple.metaClass.methods) {
println metaMethod.name
}
But I can't find a way to print names of arguments.. Also, is it possible to know if there are default values for the arguments?
Could you please advise?