话说如果我想获得这个类public SuperMan(String name, String sex, int age) 构造函数的参数名有木有办法呢?这样的话不就可以在完全不看类的情况下反射类的整个结构,不然的话,我只知道前面两个参数是String类型,但是不确定对应哪个属性,即便获得了,也无法构建对象
package test;
import java.util.Date;
public class SuperMan {
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
String name;
private String sex;
private int age;
private Date birthDay = new Date();
public Date getBirthDay() {
return birthDay;
}
public void setBirthDay(Date birthDay) {
this.birthDay = birthDay;
}
public SuperMan(){
}
private SuperMan(String name){
this.name = name;
}
public SuperMan(String name, String sex, int age) {
super();
this.name = name;
this.sex = sex;
this.age = age;
}
}
|