public class ReflectionHelpers
extends java.lang.Object
| Constructor and Description |
|---|
ReflectionHelpers() |
| Modifier and Type | Method and Description |
|---|---|
static <T> T |
getPrivateFieldValue(java.lang.Class<?> cls,
java.lang.Object target,
java.lang.String fieldName,
java.lang.Class<T> fieldType)
Fetches the value of a private instance field.
|
static <T> T |
setPrivateFieldValue(java.lang.Class<?> cls,
T target,
java.lang.String fieldName,
java.lang.Object newValue)
Sets the given value to a private instance field.
|
public static <T> T setPrivateFieldValue(java.lang.Class<?> cls,
T target,
java.lang.String fieldName,
java.lang.Object newValue)
cls - The target class or a superclass.target - Target instance.fieldName - Target field name.newValue - The value to be set.public static <T> T getPrivateFieldValue(java.lang.Class<?> cls,
java.lang.Object target,
java.lang.String fieldName,
java.lang.Class<T> fieldType)
cls - The target class or a superclass.target - Target instance.fieldName - Target field name.fieldType - Field type.