Get all declared fields of a certain class

getFields() : Get all public (public) fields of a certain class, including fields in the parent class.
getDeclaredFields() : Get all declared fields of a certain class, including public, private, and protected, but not including the declared fields of the parent class.
getDeclaredMethod : Get all the declared methods of the current class, including public, protected and private modified methods. It should be noted that these methods must be declared in the current class, and those inherited from the parent class are not counted. The methods that implement the interface are included because they are declared.
getMethod : Get all public methods of the current class and the parent class. The parent class here refers to all parent classes in the inheritance hierarchy. For example, if A inherits B and B inherits C, then both B and C belong to A's parent class.
**getDeclaredConstructors()** returns all types of constructors, including public and non-public
**getConstructors()** only returns public.

Guess you like

Origin blog.csdn.net/weixin_44967200/article/details/111600994