public final class FieldUtils extends Object
| 构造器和说明 |
|---|
FieldUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static Field |
findField(Class clazz,
String name)
|
static Field |
findField(Class clazz,
String name,
Class type)
|
static List<Field> |
findMatchedFields(Class targetClass,
Class ann)
|
static Object |
getField(Object t,
String name)
Get the field represented by the supplied
field object on
the specified target object. |
static void |
setField(Object t,
String name,
Object value)
Set the field represented by the supplied
field object on
the specified target object to the specified
value. |
static String |
toObjectType(String primitiveType) |
public static Object getField(Object t, String name)
field object on
the specified target object. In accordance with
Field.get(Object) semantics, the returned value is automatically
wrapped if the underlying field has a primitive type.
Thrown exceptions are handled via a call to
t - the target object from which to get the fieldname - the field to getpublic static void setField(Object t, String name, Object value)
field object on
the specified target object to the specified
value. In accordance with Field.set(Object, Object)
semantics, the new value is automatically unwrapped if the underlying
field has a primitive type.
Thrown exceptions are handled via a call to
t - the target object on which to set the fieldname - the field to setvalue - the value to set; may be nullpublic static Field findField(Class clazz, String name)
field on the supplied Class with
the supplied name. Searches all superclasses up to
Object.clazz - the class to introspectname - the name of the fieldnull if not foundpublic static Field findField(Class clazz, String name, Class type)
field on the supplied Class with
the supplied name and/or type. Searches all
superclasses up to Object.clazz - the class to introspectname - the name of the field (may be null if type is
specified)type - the type of the field (may be null if name is
specified)null if not foundCopyright © 2022 Baidu, Inc.. All rights reserved.