Package io.lumine.mythic.core.utils
Class ReflectionUtils
java.lang.Object
io.lumine.mythic.core.utils.ReflectionUtils
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
static enum
-
Method Summary
Modifier and TypeMethodDescriptionstatic Constructor<?>
getConstructor
(Class<?> clazz, Class<?>... parameterTypes) static Constructor<?>
getConstructor
(String className, ReflectionUtils.PackageType packageType, Class<?>... parameterTypes) static Field
static Field
getField
(String className, ReflectionUtils.PackageType packageType, boolean declared, String fieldName) static Method
static Method
getMethod
(String className, ReflectionUtils.PackageType packageType, String methodName, Class<?>... parameterTypes) static Object
static Object
static Object
getValue
(Object instance, String className, ReflectionUtils.PackageType packageType, boolean declared, String fieldName) static Object
instantiateObject
(Class<?> clazz, Object... arguments) static Object
instantiateObject
(String className, ReflectionUtils.PackageType packageType, Object... arguments) static Object
invokeMethod
(Object instance, Class<?> clazz, String methodName, Object... arguments) static Object
invokeMethod
(Object instance, String className, ReflectionUtils.PackageType packageType, String methodName, Object... arguments) static Object
invokeMethod
(Object instance, String methodName, Object... arguments) static void
static void
static void
setValue
(Object instance, String className, ReflectionUtils.PackageType packageType, boolean declared, String fieldName, Object value)
-
Method Details
-
getConstructor
public static Constructor<?> getConstructor(Class<?> clazz, Class<?>... parameterTypes) throws NoSuchMethodException - Throws:
NoSuchMethodException
-
getConstructor
public static Constructor<?> getConstructor(String className, ReflectionUtils.PackageType packageType, Class<?>... parameterTypes) throws NoSuchMethodException, ClassNotFoundException -
instantiateObject
public static Object instantiateObject(Class<?> clazz, Object... arguments) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException -
instantiateObject
public static Object instantiateObject(String className, ReflectionUtils.PackageType packageType, Object... arguments) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, ClassNotFoundException -
getMethod
public static Method getMethod(Class<?> clazz, String methodName, Class<?>... parameterTypes) throws NoSuchMethodException - Throws:
NoSuchMethodException
-
getMethod
public static Method getMethod(String className, ReflectionUtils.PackageType packageType, String methodName, Class<?>... parameterTypes) throws NoSuchMethodException, ClassNotFoundException -
invokeMethod
public static Object invokeMethod(Object instance, String methodName, Object... arguments) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException -
invokeMethod
public static Object invokeMethod(Object instance, Class<?> clazz, String methodName, Object... arguments) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException -
invokeMethod
public static Object invokeMethod(Object instance, String className, ReflectionUtils.PackageType packageType, String methodName, Object... arguments) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, ClassNotFoundException -
getField
public static Field getField(Class<?> clazz, boolean declared, String fieldName) throws NoSuchFieldException, SecurityException -
getField
public static Field getField(String className, ReflectionUtils.PackageType packageType, boolean declared, String fieldName) throws NoSuchFieldException, SecurityException, ClassNotFoundException -
getValue
public static Object getValue(Object instance, Class<?> clazz, boolean declared, String fieldName) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException -
getValue
public static Object getValue(Object instance, String className, ReflectionUtils.PackageType packageType, boolean declared, String fieldName) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException, ClassNotFoundException -
getValue
public static Object getValue(Object instance, boolean declared, String fieldName) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException -
setValue
public static void setValue(Object instance, Class<?> clazz, boolean declared, String fieldName, Object value) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException -
setValue
public static void setValue(Object instance, String className, ReflectionUtils.PackageType packageType, boolean declared, String fieldName, Object value) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException, ClassNotFoundException -
setValue
public static void setValue(Object instance, boolean declared, String fieldName, Object value) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException
-