1 //获取所有的属性,但不包括从父类继承下来的属性
2 public Field[] getDeclaredFields() throws SecurityException
3 //获取自身的所有的 public 属性,包括从父类继承下来的。
4 public Field[] getFields() throws SecurityException
5 //获取在本类中声明的指定的属性,参数为属性的名称
6 public Field getDeclaredField(String name)
7 //获取指定的公有属性,包括父类的,参数为属性的名称
8 public Field getField(String name)
2.3.2 获取方法Method对象
//获取本类声明指定的的方法,第一个参数是方法的名称,后面的参数是方法参数类型的类,
//如获取setName(String name)方法,getDeclareMethod(“setName”,String.Class)
public Method getDeclaredMethod(String name, Class<?>... parameterTypes)
//获取公有的方法,包括父类的
public Method getMethod(String name, Class<?>... parameterTypes)
//获取本类中声明的所有方法
public Method[] getDeclaredMethods()
//获取所有的公有方法,包括父类的
public Method[] getMethods()
2.3.3 获取构造器Constructor对象
//获取本类中指定的构造方法
public Constructor<T> getDeclaredConstructor(Class<?>... parameterTypes)
//获取指定的公有构造方法
public Constructor<T> getConstructor(Class<?>... parameterTypes)
//获取本类中所有的构造方法
public Constructor<?>[] getDeclar
2.3.1 获取属性Field的对象1 //获取所有的属性,但不包括从父类继承下来的属性2 public Field[] getDeclaredFields() throws SecurityException 3 //获取自身的所有的 public 属性,包括从父类继承下来的。4 public Field[] getFields() throws SecurityException5 //获取在本类中声明的指定的属性,参数为属性的名称6 public Field getDecl