接口 FieldUtils
-
public interface FieldUtilsThe utilities class for Java ReflectionField- 从以下版本开始:
- 2.7.6
-
-
方法概要
静态方法 修饰符和类型 方法 说明 static FieldfindField(Class<?> declaredClass, String fieldName)Find theFieldby the name in the specified class and its inherited typesstatic FieldfindField(Object object, String fieldName)Find theFieldby the name in the specified class and its inherited typesstatic FieldgetDeclaredField(Class<?> declaredClass, String fieldName)Like theClass.getDeclaredField(String)method without throwing anyExceptionstatic <T> TgetFieldValue(Object object, Field field)Get the value of the specifiedFieldstatic ObjectgetFieldValue(Object object, String fieldName)Get the value of the specifiedFieldstatic <T> TsetFieldValue(Object object, Field field, T value)Set the value for the specifiedFieldstatic <T> TsetFieldValue(Object object, String fieldName, T value)Set the value for the specifiedField
-
-
-
方法详细资料
-
getDeclaredField
static Field getDeclaredField(Class<?> declaredClass, String fieldName)
Like theClass.getDeclaredField(String)method without throwing anyException- 参数:
declaredClass- the declared classfieldName- the name ofField- 返回:
- if can't be found, return
null
-
findField
static Field findField(Class<?> declaredClass, String fieldName)
Find theFieldby the name in the specified class and its inherited types- 参数:
declaredClass- the declared classfieldName- the name ofField- 返回:
- if can't be found, return
null
-
findField
static Field findField(Object object, String fieldName)
Find theFieldby the name in the specified class and its inherited types- 参数:
object- the object whose field should be modifiedfieldName- the name ofField- 返回:
- if can't be found, return
null
-
getFieldValue
static Object getFieldValue(Object object, String fieldName)
Get the value of the specifiedField
-
getFieldValue
static <T> T getFieldValue(Object object, Field field)
Get the value of the specifiedField
-
setFieldValue
static <T> T setFieldValue(Object object, String fieldName, T value)
Set the value for the specifiedField
-
-