Introduction to functions such as getDeclaredFields of android

Function name

introduce

getFields()

如:public String name;

Get all public (public) fields of a class, including fields in parent classes.

getDeclaredFields()

Obtain all declared fields of a class, including public, private and protected, but not including the declared fields of the parent class.

getDeclaredMethod

Get all 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 have declarations.

getMethod

Get all public methods of the current class and parent class. The parent class here refers to all parent classes in the inheritance hierarchy. For example, if A inherits from B and B inherits from C, then both B and C belong to the parent class of A.

getDeclaredConstructors()

Get all types of constructors of the current class, including public and non-public

getConstructors()

Get the constructor of the current class, only return public.

Guess you like

Origin blog.csdn.net/baidu_24743861/article/details/129728812