@Deprecated
public class ReflectionHelper
extends java.lang.Object
ObfuscationReflectionHelper
when dealing with obfuscated fields or methods.Modifier and Type | Class and Description |
---|---|
static class |
ReflectionHelper.UnableToAccessFieldException
Deprecated.
|
static class |
ReflectionHelper.UnableToFindClassException
Deprecated.
|
static class |
ReflectionHelper.UnableToFindFieldException
Deprecated.
|
static class |
ReflectionHelper.UnableToFindMethodException
Deprecated.
|
static class |
ReflectionHelper.UnknownConstructorException
Deprecated.
|
Constructor and Description |
---|
ReflectionHelper()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
static <T> java.lang.reflect.Constructor<T> |
findConstructor(java.lang.Class<T> klass,
java.lang.Class<?>... parameterTypes)
Deprecated.
Finds a constructor in the specified class that has matching parameter types.
|
static java.lang.reflect.Field |
findField(java.lang.Class<?> clazz,
java.lang.String... fieldNames)
Deprecated.
|
static java.lang.reflect.Field |
findField(java.lang.Class<?> clazz,
java.lang.String fieldName,
java.lang.String fieldObfName)
Deprecated.
Finds a field with the specified name in the given class and makes it accessible.
|
static java.lang.reflect.Method |
findMethod(java.lang.Class<?> clazz,
java.lang.String methodName,
java.lang.String methodObfName,
java.lang.Class<?>... parameterTypes)
Deprecated.
Finds a method with the specified name and parameters in the given class and makes it accessible.
|
static java.lang.Class<? super java.lang.Object> |
getClass(java.lang.ClassLoader loader,
java.lang.String... classNames)
Deprecated.
|
static <T,E> T |
getPrivateValue(java.lang.Class<? super E> classToAccess,
E instance,
int fieldIndex)
Deprecated.
|
static <T,E> T |
getPrivateValue(java.lang.Class<? super E> classToAccess,
E instance,
java.lang.String... fieldNames)
Deprecated.
|
static <T,E> T |
getPrivateValue(java.lang.Class<? super E> classToAccess,
E instance,
java.lang.String fieldName,
java.lang.String fieldObfName)
Deprecated.
|
static <T,E> void |
setPrivateValue(java.lang.Class<? super T> classToAccess,
T instance,
E value,
int fieldIndex)
Deprecated.
|
static <T,E> void |
setPrivateValue(java.lang.Class<? super T> classToAccess,
T instance,
E value,
java.lang.String... fieldNames)
Deprecated.
|
static <T,E> void |
setPrivateValue(java.lang.Class<? super T> classToAccess,
T instance,
E value,
java.lang.String fieldName,
java.lang.String fieldObfName)
Deprecated.
|
@Deprecated public static java.lang.reflect.Field findField(java.lang.Class<?> clazz, java.lang.String... fieldNames)
findField(Class, String, String)
@Nonnull public static java.lang.reflect.Field findField(@Nonnull java.lang.Class<?> clazz, @Nonnull java.lang.String fieldName, @Nullable java.lang.String fieldObfName)
Throws an exception if the field is not found.
clazz
- The class to find the field on.fieldName
- The name of the field to find (used in developer environments, i.e. "maxStackSize").fieldObfName
- The obfuscated name of the field to find (used in obfuscated environments, i.e. "field_77777_bU").
If the name you are looking for is on a class that is never obfuscated, this should be null.@Deprecated public static <T,E> T getPrivateValue(java.lang.Class<? super E> classToAccess, @Nullable E instance, int fieldIndex)
@Deprecated public static <T,E> T getPrivateValue(java.lang.Class<? super E> classToAccess, E instance, java.lang.String... fieldNames)
getPrivateValue(Class, Object, String, String )
public static <T,E> T getPrivateValue(java.lang.Class<? super E> classToAccess, @Nullable E instance, java.lang.String fieldName, @Nullable java.lang.String fieldObfName)
@Deprecated public static <T,E> void setPrivateValue(java.lang.Class<? super T> classToAccess, T instance, E value, int fieldIndex)
@Deprecated public static <T,E> void setPrivateValue(java.lang.Class<? super T> classToAccess, T instance, E value, java.lang.String... fieldNames)
setPrivateValue(Class, Object, Object, String, String)
public static <T,E> void setPrivateValue(java.lang.Class<? super T> classToAccess, @Nullable T instance, @Nullable E value, java.lang.String fieldName, @Nullable java.lang.String fieldObfName)
public static java.lang.Class<? super java.lang.Object> getClass(java.lang.ClassLoader loader, java.lang.String... classNames)
@Nonnull public static java.lang.reflect.Method findMethod(@Nonnull java.lang.Class<?> clazz, @Nonnull java.lang.String methodName, @Nullable java.lang.String methodObfName, java.lang.Class<?>... parameterTypes)
Throws an exception if the method is not found.
clazz
- The class to find the method on.methodName
- The name of the method to find (used in developer environments, i.e. "getWorldTime").methodObfName
- The obfuscated name of the method to find (used in obfuscated environments, i.e. "func_72820_D").
If the name you are looking for is on a class that is never obfuscated, this should be null.parameterTypes
- The parameter types of the method to find.@Nonnull public static <T> java.lang.reflect.Constructor<T> findConstructor(@Nonnull java.lang.Class<T> klass, @Nonnull java.lang.Class<?>... parameterTypes)
T
- The typeklass
- The class to find the constructor inparameterTypes
- The parameter types of the constructor.java.lang.NullPointerException
- if klass
is nulljava.lang.NullPointerException
- if parameterTypes
is nullReflectionHelper.UnknownConstructorException
- if the constructor could not be found