The following snippet is part of a huge Java project that I'm working on:
Map<String, String> method_types = new HashMap<String, String>();
Method[] methods = ClassLoader.getSystemClassLoader().loadClass("className").getDeclaredMethods();
for (Method method : methods) {
String type = Modifier.toString(method.getModifiers());
method_types.put(method.getName(), type);
System.out.println("-> " + method.getName() + " -- " + Modifier.toString(method.getModifiers()));
}
This will print the following:
-> zoo -- private
-> zoo -- public
-> boo -- public
-> thro -- private
-> foo -- protected
What I want is to print the methods along with their parameters such as:
ArtClassPrivateMethod.zoo(I)V
ArtClassPrivateMethod.boo(I)Z
ArtClassPrivateMethod.zoo(II)V
ArtClassPrivateMethod.thro()V
ArtClassPrivateMethod.<init>(Ljava/lang/String;)V
Note that the method zoo(II)V
is the private one.
Is that possible to be printed?