public final class FieldUtils extends Object
| 构造器和说明 |
|---|
FieldUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static void |
addList(List list,
boolean value) |
static void |
addList(List list,
byte value) |
static void |
addList(List list,
char value) |
static void |
addList(List list,
double value) |
static void |
addList(List list,
float value) |
static void |
addList(List list,
int value) |
static void |
addList(List list,
long value) |
static void |
addList(List list,
Object value) |
static void |
addList(List list,
short value) |
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 String |
getInBoxedFieldname(String name,
String primitiveType) |
static String |
getUnboxedFieldname(String name,
String primitiveType) |
static void |
setField(Object t,
String name,
boolean value) |
static void |
setField(Object t,
String name,
byte value) |
static void |
setField(Object t,
String name,
char value) |
static void |
setField(Object t,
String name,
double value) |
static void |
setField(Object t,
String name,
float value) |
static void |
setField(Object t,
String name,
int value) |
static void |
setField(Object t,
String name,
long value) |
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 void |
setField(Object t,
String name,
short 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 void addList(List list, int value)
public static void addList(List list, short value)
public static void addList(List list, double value)
public static void addList(List list, float value)
public static void addList(List list, byte value)
public static void addList(List list, char value)
public static void addList(List list, long value)
public static void addList(List list, boolean value)
public 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 © 2019 Baidu, Inc.. All rights reserved.