public final class ReflectionUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T> T |
getFieldValue(Object object,
String fieldName)
Gets the given object's field value.
|
static void |
setFieldValue(Object object,
Object value,
String fieldName)
Sets the given object's field to the given value.
|
public static void setFieldValue(Object object, Object value, String fieldName) throws NoSuchFieldException, IllegalArgumentException, IllegalAccessException
object - the object whose field value will be setvalue - the value which the field will be set tofieldName - the field which will be setNoSuchFieldException - NoSuchFieldExceptionIllegalArgumentException - IllegalArgumentExceptionIllegalAccessException - IllegalAccessExceptionpublic static <T> T getFieldValue(Object object, String fieldName) throws NoSuchFieldException, IllegalAccessException
T - the return typeobject - the object whose field value will be setfieldName - the field which will be retrievedNoSuchFieldException - NoSuchFieldExceptionIllegalAccessException - IllegalAccessException