Constructor Parameters Via Java Reflection -


i using reflection in java. can please have constructor parameter names , values?

here code:

  public string getconstructors(class aclass)   {   stringbuilder classconstructors = new stringbuilder();   constructor[] constructors = aclass.getconstructors();   string separator = system.getproperty( "line.separator" );   (constructor c: constructors)   {       boolean ispublic = modifier.ispublic(c.getmodifiers());       class[] parametertypes = c.getparametertypes();       (class pt : parametertypes)       {           system.out.println(pt.getname());           //field[] fields = pt.getdeclaredfields();           //for (field f : fields)            //{               //system.out.println(f.gettype());           //}       }   }   return classconstructors.tostring(); 

}

the constructor testing has following parameters:

string name, int diameter 

the system.out.println(pt.getname()); line of code printing out following:

java.lang.string int 

is possible type , name of each of parameters?

you have types, , there's no way names (since they're not preserved part of bytecodes).


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -