public final class ReflectionUtils
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
ReflectionUtils.UnableToFindFieldException |
static class |
ReflectionUtils.UnableToFindMethodException |
static class |
ReflectionUtils.UnableToGetFieldException |
static class |
ReflectionUtils.UnableToInvokeMethodException |
static class |
ReflectionUtils.UnableToSetFieldException |
| Constructor and Description |
|---|
ReflectionUtils() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
doesClassExist(java.lang.String className)
A simple check to see if a class exists.
|
static java.lang.reflect.Field |
getCachedField(java.lang.Class<?> classToAccess,
java.lang.String mcpName,
java.lang.String srgName)
Retrieves a cached Field from the Field cache.
|
static <T,E> T |
getCachedFieldValue(java.lang.Class<? super E> classToAccess,
E instance,
java.lang.String mcpName,
java.lang.String srgName)
Retrieves the value of a cached Field.
|
static java.lang.reflect.Method |
getCachedMethod(java.lang.Class<?> classToAccess,
java.lang.String mcpName,
java.lang.String srgName,
java.lang.Class<?>... parameterTypes)
Retrieves a cached Method from the method cache.
|
static <T> T |
getCasted(java.lang.Object obj)
Casts an Object to a generic Type.
|
static <T> java.lang.Class<T> |
getClass(java.lang.String className)
Retrieves a Class by its name.
|
static <T,E> T |
invokeCachedMethod(java.lang.Class<? super E> classToAccess,
E instance,
java.lang.String mcpName,
java.lang.String srgName,
java.lang.Class<?>[] parameterTypes,
java.lang.Object[] parameterValues)
Invokes a Method that has been cached.
|
static <T,E> void |
setCachedFieldValue(java.lang.Class<? super E> classToAccess,
E instance,
java.lang.String mcpName,
java.lang.String srgName,
T value)
Sets the value of a cached field.
|
public static boolean doesClassExist(java.lang.String className)
className: - The name of the class you are looking for.public static <T> java.lang.Class<T> getClass(java.lang.String className)
className: - The name of the class you are trying to get.public static <T,E> void setCachedFieldValue(java.lang.Class<? super E> classToAccess,
E instance,
java.lang.String mcpName,
java.lang.String srgName,
T value)
classToAccess: - The Class that contains the Field being set.instance: - An instance of the Class that contains the Field.mcpName: - The MCP mapping for the field name.srgName: - The SRG mapping for the field name.value: - The new value being set for the Field.public static <T,E> T getCachedFieldValue(java.lang.Class<? super E> classToAccess,
E instance,
java.lang.String mcpName,
java.lang.String srgName)
classToAccess: - The Class that contains the Field being used.instance: - An instance of the Class that contains the Field.mcpName: - The MCP mapping for the field name.srgName: - The SRG mapping for the field name.public static <T,E> T invokeCachedMethod(java.lang.Class<? super E> classToAccess,
E instance,
java.lang.String mcpName,
java.lang.String srgName,
java.lang.Class<?>[] parameterTypes,
java.lang.Object[] parameterValues)
classToAccess: - The Class that contains the method being accessed.instance: - An instance of the Class that contains the method.mcpName: - The MCP mapping for the method name.srgName: - The SRG mapping for the method name.parameterTypes: - The parameters used by this Method.parameterValues: - The parameter values to pass to the method.public static java.lang.reflect.Field getCachedField(java.lang.Class<?> classToAccess,
java.lang.String mcpName,
java.lang.String srgName)
classToAccess: - The Class that contains the field being accessed.mcpName: - The MCP mapping for the field name.srgName: - The SRG mapping for the field name.public static java.lang.reflect.Method getCachedMethod(java.lang.Class<?> classToAccess,
java.lang.String mcpName,
java.lang.String srgName,
java.lang.Class<?>... parameterTypes)
classToAccess: - The Class that contains the method you want.mcpName: - The MCP mapping for the method name.srgName: - The SRG mapping for the method name.parameterTypes: - The parameters that are used by the method.public static <T> T getCasted(java.lang.Object obj)
obj: - The Object to cast.