public class ReflectionHelper
extends java.lang.Object
Constructor and Description |
---|
ReflectionHelper() |
Modifier and Type | Method and Description |
---|---|
static java.lang.reflect.Field |
findField(java.lang.Class<?> clazz,
java.lang.String fieldName,
java.lang.String obfName) |
static java.lang.reflect.Method |
findMethod(java.lang.Class<?> clazz,
java.lang.String name,
java.lang.String obfName,
java.lang.Class<?>... parameters) |
static void |
flipVariableFinality(java.lang.reflect.Field field) |
static void |
flipVariableFinality(java.lang.reflect.Field field,
java.lang.Runnable runnable) |
static <T,E> E |
getPrivateValue(java.lang.Class<? super T> clazz,
T instance,
java.lang.String fieldName) |
static <T> void |
setPrivateValue(java.lang.Class<? super T> clazz,
T instance,
java.lang.Object value,
java.lang.String fieldName) |
public static <T,E> E getPrivateValue(java.lang.Class<? super T> clazz, T instance, java.lang.String fieldName)
clazz
- The class the field exists in.instance
- The instance of the class that you want to access, or null for a static field.fieldName
- The name of the fieldpublic static <T> void setPrivateValue(java.lang.Class<? super T> clazz, T instance, java.lang.Object value, java.lang.String fieldName)
public static java.lang.reflect.Field findField(java.lang.Class<?> clazz, java.lang.String fieldName, java.lang.String obfName)
public static java.lang.reflect.Method findMethod(java.lang.Class<?> clazz, java.lang.String name, java.lang.String obfName, java.lang.Class<?>... parameters)
public static void flipVariableFinality(java.lang.reflect.Field field) throws java.lang.NoSuchFieldException, java.lang.IllegalAccessException
java.lang.NoSuchFieldException
java.lang.IllegalAccessException
public static void flipVariableFinality(java.lang.reflect.Field field, java.lang.Runnable runnable) throws java.lang.NoSuchFieldException, java.lang.IllegalAccessException
java.lang.NoSuchFieldException
java.lang.IllegalAccessException