Search code examples
javadynamic-datadynamic-programming

Java - Find the class name and the methods in that class also find the arguments available for the method


I have a package where i have to find all the class available in the package and methods available for the particular class and arguments for the methods available in the method.

like :

package com.test.dynamic;

public class Test{
Public testMethod(int test, String strArgument){
//some implementation
}
}

in this if i give package name than i must be able to get class name : Test and method name testMethod and arguments test and strArgument if possible their types also.

how to do this in java.

Best Regards


Solution

  • Go through Reflection API in java there are many methods like getName(), getInstance()..etc it will help you: http://www.roseindia.net/java/reflect/Class.shtml