java - LocalVariableTableParameterNameDiscoverer does not work -
i want parameter names of method of interface outside package.
looks localvariabletableparameternamediscoverer can parameter names of methods local classes. not parameter names of methods interfaces outside package.
please help
private localvariabletableparameternamediscoverer namer =new localvariabletableparameternamediscoverer(); class currentclass = class.forname("com.soa.process.bpel.runtime.script.scriptedalertreporter"); methods=currentclass.getdeclaredmethods(); (int j = 0; j < methods.length; j++) { method=currentclass.getmethod(methods[j].getname(),methods[j].getparametertypes()); parameternames = namer.getparameternames(method); if(parameternames!=null && parameternames.length>0) { } }
it's nothing whether interface outside of package. localvariabletableparameternamediscoverer works inspecting debug information generated java compiler. unfortunately debug information not include parameter names interface methods.
java 8 lets access interface parameter names via reflection, or if you're stuck earlier java version can try paranamer.
Comments
Post a Comment