getDeclaredFields() 用法说明

getFields():获得某个类的所有的公共(public)的字段,包括父类中的字段。
getDeclaredFields():获得某个类的所有声明的字段,即包括public、private 和proteced,但是不包括父类的申明字段。

···········································································································
getDeclaredMethod:获取当前类的所有声明的方法,包括public、protected和private修饰的方法。需要注意的是,这些方法一定是在当前类中声明的,从父类中继承的不算,实现接口的方法由于有声明所以包括在内。
getMethod:获取当前类和父类的所有public的方法。这里的父类,指的是继承层次中的所有父类。比如说,A继承B,B继承C,那么B和C都属于A的父类。
···········································································································
getDeclaredConstructors()的返回所有类型的构造器,包括public和非public
getConstructors()只返回public。

···········································································································

posted @ 2023-01-31 15:57  r1-12king  阅读(324)  评论(0编辑  收藏  举报