public class FieldUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static Class<?> |
nullObjectClass |
| Constructor and Description |
|---|
FieldUtils() |
| Modifier and Type | Method and Description |
|---|---|
static Field |
getField(Class<?> cls,
String fieldName)
Gets an accessible
Field by name respecting scope. |
static Field |
getField(Class<?> cls,
String fieldName,
boolean forceAccess)
Gets an accessible
Field by name, breaking scope if requested. |
static Class<?> |
getFieldClass(Map dataMap,
String fieldName,
Object value) |
static Class<?> |
getFieldClass(Object value) |
static String |
resolveCglibFieldName(Field field)
Parsing the name matching cglib。
|
public static Class<?> nullObjectClass
public static String resolveCglibFieldName(Field field)
null -> null
string1 -> string1
String2 -> string2
sTring3 -> STring3
STring4 -> STring4
STRING5 -> STRING5
STRing6 -> STRing6
field - fieldpublic static Field getField(Class<?> cls, String fieldName)
Field by name respecting scope. Superclasses/interfaces will be considered.cls - the Class to reflect, must not be nullfieldName - the field name to obtainIllegalArgumentException - if the class is null, or the field name is blank or emptypublic static Field getField(Class<?> cls, String fieldName, boolean forceAccess)
Field by name, breaking scope if requested. Superclasses/interfaces will be
considered.cls - the Class to reflect, must not be nullfieldName - the field name to obtainforceAccess - whether to break scope restrictions using the
AccessibleObject.setAccessible(boolean) method. false will
only
match public fields.NullPointerException - if the class is nullIllegalArgumentException - if the field name is blank or empty or is matched at multiple places
in the inheritance hierarchyCopyright © 2018–2023 Alibaba Group. All rights reserved.