Package org.apache.dubbo.common.utils
Interface FieldUtils
public interface FieldUtils
The utilities class for Java Reflection
Field- Since:
- 2.7.6
-
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic FieldFind theFieldby the name in the specified class and its inherited typesstatic FieldFind 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
-
Method Details
-
getDeclaredField
Like theClass.getDeclaredField(String)method without throwing anyException- Parameters:
declaredClass- the declared classfieldName- the name ofField- Returns:
- if field can't be found, return
null
-
findField
Find theFieldby the name in the specified class and its inherited types- Parameters:
declaredClass- the declared classfieldName- the name ofField- Returns:
- if can't be found, return
null
-
findField
Find theFieldby the name in the specified class and its inherited types- Parameters:
object- the object whose field should be modifiedfieldName- the name ofField- Returns:
- if can't be found, return
null
-
getFieldValue
Get the value of the specifiedField -
getFieldValue
Get the value of the specifiedField -
setFieldValue
Set the value for the specifiedField -
setFieldValue
Set the value for the specifiedField
-