public class Classes extends Object
| Constructor and Description |
|---|
Classes() |
| Modifier and Type | Method and Description |
|---|---|
static Field |
getAnyField(Class<?> cls,
String name)
Gets the specified field by searching all fields including
any access control and any base class.
|
public static final Field getAnyField(Class<?> cls, String name) throws NoSuchFieldException
Note: public fields don't be treated different. If the caller wants to search public fields first, it has to call Class.getField first.
cls - the class to searchname - the field nameNoSuchFieldException - if a matching field is not found.SecurityException - if access to the information is denied.#getAccessibleObject(Class, String, Class[], int),
#getAnyMethod(Class, String, Class[])Copyright © 2020. All rights reserved.