J
JessyCute
I want to get parameter name from specify method. Example:
Code:
public class AClass {
public AClass() {}
public int checkReturn(String input_check, int index){
return 0;
}
}
I want to get "input_check" string and "index" string that are the
parameter name of checkReturn.
Currently, I tried to use reflection java.lang.reflect.
Code:
String className = "AClass";
Class c = Class.forName(className);
Method[] m = c.getMethods();
Constructor[] ctor = c.getConstructors();
System.out.println("\nConstructors list:");
for(int i = 0; i < ctor.length; i ++){
System.out.println(ctor.toString());
}
System.out.println("\nMethod list:");
for(int i = 0; i < m.length; i ++){
System.out.println("method-" + i + ">" + m.getName() );
System.out.println(m.toString());
}
But it doesn't know what is the parameter name, any one know. Thank you
in advance. ^^
Code:
public class AClass {
public AClass() {}
public int checkReturn(String input_check, int index){
return 0;
}
}
I want to get "input_check" string and "index" string that are the
parameter name of checkReturn.
Currently, I tried to use reflection java.lang.reflect.
Code:
String className = "AClass";
Class c = Class.forName(className);
Method[] m = c.getMethods();
Constructor[] ctor = c.getConstructors();
System.out.println("\nConstructors list:");
for(int i = 0; i < ctor.length; i ++){
System.out.println(ctor.toString());
}
System.out.println("\nMethod list:");
for(int i = 0; i < m.length; i ++){
System.out.println("method-" + i + ">" + m.getName() );
System.out.println(m.toString());
}
But it doesn't know what is the parameter name, any one know. Thank you
in advance. ^^