Package io.github.toolfactory.narcissus
Class Narcissus
java.lang.Object
io.github.toolfactory.narcissus.Narcissus
public class Narcissus
extends java.lang.Object
Narcissus.
- Author:
- Luke Hutchison
-
Field Summary
Fields Modifier and Type Field Description static booleanlibraryLoadedWhether or not the library was successfully loaded. -
Constructor Summary
Constructors Constructor Description Narcissus() -
Method Summary
Modifier and Type Method Description static java.lang.ObjectallocateInstance(java.lang.Class<?> cls)Allocate an object instance, without calling any constructor.static java.util.List<java.lang.reflect.Constructor<?>>enumerateConstructors(java.lang.Class<?> cls)Enumerate all constructors in the given class, ignoring visibility and bypassing security checks.static java.util.List<java.lang.reflect.Field>enumerateFields(java.lang.Class<?> cls)Enumerate all fields in the given class, ignoring visibility and bypassing security checks.static java.util.List<java.lang.reflect.Method>enumerateMethods(java.lang.Class<?> cls)Enumerate all methods in the given class, ignoring visibility and bypassing security checks.static java.lang.Class<?>findClass(java.lang.String className)Finds a class by name (e.g.static java.lang.reflect.FieldfindField(java.lang.Class<?> cls, java.lang.String fieldName)Find a field by name in the given class, ignoring visibility and bypassing security checks.static java.lang.reflect.MethodfindMethod(java.lang.Class<?> cls, java.lang.String methodName, java.lang.Class<?>... paramTypes)Find a method by name in the given class, ignoring visibility and bypassing security checks.static booleangetBooleanField(java.lang.Object object, java.lang.reflect.Field field)Get the value of a boolean field, ignoring visibility and bypassing security checks.static bytegetByteField(java.lang.Object object, java.lang.reflect.Field field)Get the value of a byte field, ignoring visibility and bypassing security checks.static chargetCharField(java.lang.Object object, java.lang.reflect.Field field)Get the value of a char field, ignoring visibility and bypassing security checks.static <T> java.lang.reflect.Constructor<T>[]getDeclaredConstructors(java.lang.Class<T> cls)Get declared constructors, ignoring visibility and bypassing security checks.static java.lang.reflect.Field[]getDeclaredFields(java.lang.Class<?> cls)Get declared fields, ignoring visibility and bypassing security checks.static java.lang.reflect.Method[]getDeclaredMethods(java.lang.Class<?> cls)Get declared methods, ignoring visibility and bypassing security checks.static doublegetDoubleField(java.lang.Object object, java.lang.reflect.Field field)Get the value of a double field, ignoring visibility and bypassing security checks.static java.lang.ObjectgetField(java.lang.Object object, java.lang.reflect.Field field)Get the value of an object field, ignoring visibility and bypassing security checks, boxing the value if necessary.static floatgetFloatField(java.lang.Object object, java.lang.reflect.Field field)Get the value of a float field, ignoring visibility and bypassing security checks.static intgetIntField(java.lang.Object object, java.lang.reflect.Field field)Get the value of an int field, ignoring visibility and bypassing security checks.static longgetLongField(java.lang.Object object, java.lang.reflect.Field field)Get the value of a long field, ignoring visibility and bypassing security checks.static java.lang.ObjectgetObjectField(java.lang.Object object, java.lang.reflect.Field field)Get the value of an object field, ignoring visibility and bypassing security checks.static shortgetShortField(java.lang.Object object, java.lang.reflect.Field field)Get the value of a short field, ignoring visibility and bypassing security checks.static booleangetStaticBooleanField(java.lang.reflect.Field field)Get the value of a static boolean field, ignoring visibility and bypassing security checks.static bytegetStaticByteField(java.lang.reflect.Field field)Get the value of a static byte field, ignoring visibility and bypassing security checks.static chargetStaticCharField(java.lang.reflect.Field field)Get the value of a static char field, ignoring visibility and bypassing security checks.static doublegetStaticDoubleField(java.lang.reflect.Field field)Get the value of a static double field, ignoring visibility and bypassing security checks.static java.lang.ObjectgetStaticField(java.lang.reflect.Field field)Get the value of a static field, ignoring visibility and bypassing security checks, boxing the value if necessary.static floatgetStaticFloatField(java.lang.reflect.Field field)Get the value of a static float field, ignoring visibility and bypassing security checks.static intgetStaticIntField(java.lang.reflect.Field field)Get the value of a static int field, ignoring visibility and bypassing security checks.static longgetStaticLongField(java.lang.reflect.Field field)Get the value of a static long field, ignoring visibility and bypassing security checks.static java.lang.ObjectgetStaticObjectField(java.lang.reflect.Field field)Get the value of a static object field, ignoring visibility and bypassing security checks.static shortgetStaticShortField(java.lang.reflect.Field field)Get the value of a static short field, ignoring visibility and bypassing security checks.static booleaninvokeBooleanMethod(java.lang.Object object, java.lang.reflect.Method method, java.lang.Object... args)Invoke a non-static boolean-return-type method, ignoring visibility and bypassing security checks.static byteinvokeByteMethod(java.lang.Object object, java.lang.reflect.Method method, java.lang.Object... args)Invoke a non-static byte-return-type method, ignoring visibility and bypassing security checks.static charinvokeCharMethod(java.lang.Object object, java.lang.reflect.Method method, java.lang.Object... args)Invoke a non-static char-return-type method, ignoring visibility and bypassing security checks.static doubleinvokeDoubleMethod(java.lang.Object object, java.lang.reflect.Method method, java.lang.Object... args)Invoke a non-static double-return-type method, ignoring visibility and bypassing security checks.static floatinvokeFloatMethod(java.lang.Object object, java.lang.reflect.Method method, java.lang.Object... args)Invoke a non-static float-return-type method, ignoring visibility and bypassing security checks.static intinvokeIntMethod(java.lang.Object object, java.lang.reflect.Method method, java.lang.Object... args)Invoke a non-static int-return-type method, ignoring visibility and bypassing security checks.static longinvokeLongMethod(java.lang.Object object, java.lang.reflect.Method method, java.lang.Object... args)Invoke a non-static long-return-type method, ignoring visibility and bypassing security checks.static java.lang.ObjectinvokeMethod(java.lang.Object object, java.lang.reflect.Method method, java.lang.Object... args)Invoke a non-staticObject-return-type method, ignoring visibility and bypassing security checks, boxing the result if necessary.static java.lang.ObjectinvokeObjectMethod(java.lang.Object object, java.lang.reflect.Method method, java.lang.Object... args)Invoke a non-staticObject-return-type method, ignoring visibility and bypassing security checks.static shortinvokeShortMethod(java.lang.Object object, java.lang.reflect.Method method, java.lang.Object... args)Invoke a non-static short-return-type method, ignoring visibility and bypassing security checks.static booleaninvokeStaticBooleanMethod(java.lang.reflect.Method method, java.lang.Object... args)Invoke a static boolean-return-type method, ignoring visibility and bypassing security checks.static byteinvokeStaticByteMethod(java.lang.reflect.Method method, java.lang.Object... args)Invoke a static byte-return-type method, ignoring visibility and bypassing security checks.static charinvokeStaticCharMethod(java.lang.reflect.Method method, java.lang.Object... args)Invoke a static char-return-type method, ignoring visibility and bypassing security checks.static doubleinvokeStaticDoubleMethod(java.lang.reflect.Method method, java.lang.Object... args)Invoke a static double-return-type method, ignoring visibility and bypassing security checks.static floatinvokeStaticFloatMethod(java.lang.reflect.Method method, java.lang.Object... args)Invoke a static float-return-type method, ignoring visibility and bypassing security checks.static intinvokeStaticIntMethod(java.lang.reflect.Method method, java.lang.Object... args)Invoke a static int-return-type method, ignoring visibility and bypassing security checks.static longinvokeStaticLongMethod(java.lang.reflect.Method method, java.lang.Object... args)Invoke a static long-return-type method, ignoring visibility and bypassing security checks.static java.lang.ObjectinvokeStaticMethod(java.lang.reflect.Method method, java.lang.Object... args)Invoke a staticObject-return-type method, ignoring visibility and bypassing security checks, boxing the result if necessary.static java.lang.ObjectinvokeStaticObjectMethod(java.lang.reflect.Method method, java.lang.Object... args)Invoke a staticObject-return-type method, ignoring visibility and bypassing security checks.static shortinvokeStaticShortMethod(java.lang.reflect.Method method, java.lang.Object... args)Invoke a static short-return-type method, ignoring visibility and bypassing security checks.static voidinvokeStaticVoidMethod(java.lang.reflect.Method method, java.lang.Object... args)Invoke a static void-return-type method, ignoring visibility and bypassing security checks.static voidinvokeVoidMethod(java.lang.Object object, java.lang.reflect.Method method, java.lang.Object... args)Invoke a non-static void-return-type method, ignoring visibility and bypassing security checks.static voidsetAccessible(java.lang.reflect.AccessibleObject target, boolean flag)Set the private field target.override to the value of flag.static voidsetAllowedModes(java.lang.invoke.MethodHandles.Lookup consulter, int modes)Set the private field consulter.allowedModes to the value of modes.static voidsetBooleanField(java.lang.Object object, java.lang.reflect.Field field, boolean val)Set the value of a boolean field, ignoring visibility and bypassing security checks.static voidsetByteField(java.lang.Object object, java.lang.reflect.Field field, byte val)Set the value of a byte field, ignoring visibility and bypassing security checks.static voidsetCharField(java.lang.Object object, java.lang.reflect.Field field, char val)Set the value of a char field, ignoring visibility and bypassing security checks.static voidsetDoubleField(java.lang.Object object, java.lang.reflect.Field field, double val)Set the value of a double field, ignoring visibility and bypassing security checks.static voidsetField(java.lang.Object object, java.lang.reflect.Field field, java.lang.Object val)Set the value of an object field, ignoring visibility and bypassing security checks, unboxing the passed value if necessary.static voidsetFloatField(java.lang.Object object, java.lang.reflect.Field field, float val)Set the value of a float field, ignoring visibility and bypassing security checks.static voidsetIntField(java.lang.Object object, java.lang.reflect.Field field, int val)Set the value of an int field, ignoring visibility and bypassing security checks.static voidsetLongField(java.lang.Object object, java.lang.reflect.Field field, long val)Set the value of a long field, ignoring visibility and bypassing security checks.static voidsetObjectField(java.lang.Object object, java.lang.reflect.Field field, java.lang.Object val)Set the value of a object field, ignoring visibility and bypassing security checks.static voidsetShortField(java.lang.Object object, java.lang.reflect.Field field, short val)Set the value of a short field, ignoring visibility and bypassing security checks.static voidsetStaticBooleanField(java.lang.reflect.Field field, boolean val)Set the value of a static boolean field, ignoring visibility and bypassing security checks.static voidsetStaticByteField(java.lang.reflect.Field field, byte val)Set the value of a static byte field, ignoring visibility and bypassing security checks.static voidsetStaticCharField(java.lang.reflect.Field field, char val)Set the value of a static char field, ignoring visibility and bypassing security checks.static voidsetStaticDoubleField(java.lang.reflect.Field field, double val)Set the value of a static double field, ignoring visibility and bypassing security checks.static voidsetStaticField(java.lang.reflect.Field field, java.lang.Object val)Set the value of a static field, ignoring visibility and bypassing security checks, unboxing the passed value if necessary.static voidsetStaticFloatField(java.lang.reflect.Field field, float val)Set the value of a static float field, ignoring visibility and bypassing security checks.static voidsetStaticIntField(java.lang.reflect.Field field, int val)Set the value of a static int field, ignoring visibility and bypassing security checks.static voidsetStaticLongField(java.lang.reflect.Field field, long val)Set the value of a static long field, ignoring visibility and bypassing security checks.static voidsetStaticObjectField(java.lang.reflect.Field field, java.lang.Object val)Set the value of a static object field, ignoring visibility and bypassing security checks.static voidsetStaticShortField(java.lang.reflect.Field field, short val)Set the value of a static short field, ignoring visibility and bypassing security checks.static voidsneakyThrow(java.lang.Throwable throwable)Throw aThrowablewithout requiring a throws declaration.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
libraryLoaded
public static final boolean libraryLoadedWhether or not the library was successfully loaded. If this value is false, you will getUnsatisfiedLinkErrorwhen you try calling methods in this class.
-
-
Constructor Details
-
Narcissus
public Narcissus()
-
-
Method Details
-
findClass
public static java.lang.Class<?> findClass(java.lang.String className)Finds a class by name (e.g."com.xyz.MyClass") using the current classloader or the system classloader, ignoring visibility and bypassing security checks. Finds array classes if the class name is of the form"com.xyz.MyClass[][]".- Parameters:
className- the class name- Returns:
- the class reference
-
setAllowedModes
public static void setAllowedModes(java.lang.invoke.MethodHandles.Lookup consulter, int modes)Set the private field consulter.allowedModes to the value of modes. (For internal use.)- Parameters:
consulter- the consultermodes- the allowed modes to set.
-
setAccessible
public static void setAccessible(java.lang.reflect.AccessibleObject target, boolean flag)Set the private field target.override to the value of flag. (For internal use.)- Parameters:
target- the targetflag- the flag
-
allocateInstance
public static java.lang.Object allocateInstance(java.lang.Class<?> cls)Allocate an object instance, without calling any constructor. (For internal use.)- Parameters:
cls- the class to instantiate- Returns:
- the new object instance
-
sneakyThrow
public static void sneakyThrow(java.lang.Throwable throwable)Throw aThrowablewithout requiring a throws declaration. (For internal use.)- Parameters:
throwable- theThrowableto throw
-
enumerateFields
public static java.util.List<java.lang.reflect.Field> enumerateFields(java.lang.Class<?> cls)Enumerate all fields in the given class, ignoring visibility and bypassing security checks. Also iterates up through superclasses, to collect all fields of the class and its superclasses.- Parameters:
cls- the class- Returns:
- a list of
Fieldobjects representing all fields declared by the class or a superclass.
-
enumerateMethods
public static java.util.List<java.lang.reflect.Method> enumerateMethods(java.lang.Class<?> cls)Enumerate all methods in the given class, ignoring visibility and bypassing security checks. Also iterates up through superclasses, to collect all methods of the class and its superclasses.- Parameters:
cls- the class- Returns:
- a list of
Methodobjects representing all methods declared by the class or a superclass.
-
enumerateConstructors
public static java.util.List<java.lang.reflect.Constructor<?>> enumerateConstructors(java.lang.Class<?> cls)Enumerate all constructors in the given class, ignoring visibility and bypassing security checks. Also iterates up through superclasses, to collect all constructors of the class and its superclasses.- Parameters:
cls- the class- Returns:
- a list of
Constructorobjects representing all constructors declared by the class
-
findField
public static java.lang.reflect.Field findField(java.lang.Class<?> cls, java.lang.String fieldName) throws java.lang.NoSuchFieldExceptionFind a field by name in the given class, ignoring visibility and bypassing security checks.- Parameters:
cls- the classfieldName- the field name.- Returns:
- the
Field - Throws:
java.lang.NoSuchFieldException- if the class does not contain a field of the given name
-
findMethod
public static java.lang.reflect.Method findMethod(java.lang.Class<?> cls, java.lang.String methodName, java.lang.Class<?>... paramTypes) throws java.lang.NoSuchMethodExceptionFind a method by name in the given class, ignoring visibility and bypassing security checks.- Parameters:
cls- the classmethodName- the method name.paramTypes- the parameter types of the method.- Returns:
- the
Method - Throws:
java.lang.NoSuchMethodException- if the class does not contain a method of the given name
-
getDeclaredMethods
public static java.lang.reflect.Method[] getDeclaredMethods(java.lang.Class<?> cls)Get declared methods, ignoring visibility and bypassing security checks.- Parameters:
cls- the class- Returns:
- the declared methods
-
getDeclaredConstructors
public static <T> java.lang.reflect.Constructor<T>[] getDeclaredConstructors(java.lang.Class<T> cls)Get declared constructors, ignoring visibility and bypassing security checks.- Type Parameters:
T- the generic type- Parameters:
cls- the class- Returns:
- the declared constructors
-
getDeclaredFields
public static java.lang.reflect.Field[] getDeclaredFields(java.lang.Class<?> cls)Get declared fields, ignoring visibility and bypassing security checks.- Parameters:
cls- the class- Returns:
- the declared fields
-
getIntField
public static int getIntField(java.lang.Object object, java.lang.reflect.Field field)Get the value of an int field, ignoring visibility and bypassing security checks.- Parameters:
object- the object instance to get the field value fromfield- the non-static field- Returns:
- the int value of the field
-
getLongField
public static long getLongField(java.lang.Object object, java.lang.reflect.Field field)Get the value of a long field, ignoring visibility and bypassing security checks.- Parameters:
object- the object instance to get the field value fromfield- the non-static field- Returns:
- the long value of the field
-
getShortField
public static short getShortField(java.lang.Object object, java.lang.reflect.Field field)Get the value of a short field, ignoring visibility and bypassing security checks.- Parameters:
object- the object instance to get the field value fromfield- the non-static field- Returns:
- the short value of the field
-
getCharField
public static char getCharField(java.lang.Object object, java.lang.reflect.Field field)Get the value of a char field, ignoring visibility and bypassing security checks.- Parameters:
object- the object instance to get the field value fromfield- the non-static field- Returns:
- the char value of the field
-
getBooleanField
public static boolean getBooleanField(java.lang.Object object, java.lang.reflect.Field field)Get the value of a boolean field, ignoring visibility and bypassing security checks.- Parameters:
object- the object instance to get the field value fromfield- the non-static field- Returns:
- the boolean value of the field
-
getByteField
public static byte getByteField(java.lang.Object object, java.lang.reflect.Field field)Get the value of a byte field, ignoring visibility and bypassing security checks.- Parameters:
object- the object instance to get the field value fromfield- the non-static field- Returns:
- the byte value of the field
-
getFloatField
public static float getFloatField(java.lang.Object object, java.lang.reflect.Field field)Get the value of a float field, ignoring visibility and bypassing security checks.- Parameters:
object- the object instance to get the field value fromfield- the non-static field- Returns:
- the float value of the field.
-
getDoubleField
public static double getDoubleField(java.lang.Object object, java.lang.reflect.Field field)Get the value of a double field, ignoring visibility and bypassing security checks.- Parameters:
object- the object instance to get the field value fromfield- the non-static field- Returns:
- the double value of the field
-
getObjectField
public static java.lang.Object getObjectField(java.lang.Object object, java.lang.reflect.Field field)Get the value of an object field, ignoring visibility and bypassing security checks.- Parameters:
object- the object instance to get the field value fromfield- the non-static field- Returns:
- the value of the field
-
getField
public static java.lang.Object getField(java.lang.Object object, java.lang.reflect.Field field)Get the value of an object field, ignoring visibility and bypassing security checks, boxing the value if necessary.- Parameters:
object- the object instance to get the field value fromfield- the non-static field- Returns:
- the value of the field
-
setIntField
public static void setIntField(java.lang.Object object, java.lang.reflect.Field field, int val)Set the value of an int field, ignoring visibility and bypassing security checks.- Parameters:
object- the object instance in which to set the field valuefield- the non-static fieldval- the int value to set
-
setLongField
public static void setLongField(java.lang.Object object, java.lang.reflect.Field field, long val)Set the value of a long field, ignoring visibility and bypassing security checks.- Parameters:
object- the object instance in which to set the field valuefield- the non-static fieldval- the long value to set
-
setShortField
public static void setShortField(java.lang.Object object, java.lang.reflect.Field field, short val)Set the value of a short field, ignoring visibility and bypassing security checks.- Parameters:
object- the object instance in which to set the field valuefield- the non-static fieldval- the short value to set
-
setCharField
public static void setCharField(java.lang.Object object, java.lang.reflect.Field field, char val)Set the value of a char field, ignoring visibility and bypassing security checks.- Parameters:
object- the object instance in which to set the field valuefield- the non-static fieldval- the char value to set
-
setBooleanField
public static void setBooleanField(java.lang.Object object, java.lang.reflect.Field field, boolean val)Set the value of a boolean field, ignoring visibility and bypassing security checks.- Parameters:
object- the object instance in which to set the field valuefield- the non-static fieldval- the boolean value to set
-
setByteField
public static void setByteField(java.lang.Object object, java.lang.reflect.Field field, byte val)Set the value of a byte field, ignoring visibility and bypassing security checks.- Parameters:
object- the object instance in which to set the field valuefield- the non-static fieldval- the byte value to set
-
setFloatField
public static void setFloatField(java.lang.Object object, java.lang.reflect.Field field, float val)Set the value of a float field, ignoring visibility and bypassing security checks.- Parameters:
object- the object instance in which to set the field valuefield- the non-static fieldval- the float value to set
-
setDoubleField
public static void setDoubleField(java.lang.Object object, java.lang.reflect.Field field, double val)Set the value of a double field, ignoring visibility and bypassing security checks.- Parameters:
object- the object instance in which to set the field valuefield- the non-static fieldval- the double value to set
-
setObjectField
public static void setObjectField(java.lang.Object object, java.lang.reflect.Field field, java.lang.Object val)Set the value of a object field, ignoring visibility and bypassing security checks.- Parameters:
object- the object instance in which to set the field valuefield- the non-static fieldval- the value to set
-
setField
public static void setField(java.lang.Object object, java.lang.reflect.Field field, java.lang.Object val)Set the value of an object field, ignoring visibility and bypassing security checks, unboxing the passed value if necessary.- Parameters:
object- the object instance in which to set the field valuefield- the non-static fieldval- the value to set
-
getStaticIntField
public static int getStaticIntField(java.lang.reflect.Field field)Get the value of a static int field, ignoring visibility and bypassing security checks.- Parameters:
field- the static field- Returns:
- the int value of the static field
-
getStaticLongField
public static long getStaticLongField(java.lang.reflect.Field field)Get the value of a static long field, ignoring visibility and bypassing security checks.- Parameters:
field- the static field- Returns:
- the static long field
-
getStaticShortField
public static short getStaticShortField(java.lang.reflect.Field field)Get the value of a static short field, ignoring visibility and bypassing security checks.- Parameters:
field- the static field- Returns:
- the static short field
-
getStaticCharField
public static char getStaticCharField(java.lang.reflect.Field field)Get the value of a static char field, ignoring visibility and bypassing security checks.- Parameters:
field- the static field- Returns:
- the static char field
-
getStaticBooleanField
public static boolean getStaticBooleanField(java.lang.reflect.Field field)Get the value of a static boolean field, ignoring visibility and bypassing security checks.- Parameters:
field- the static field- Returns:
- the static boolean field
-
getStaticByteField
public static byte getStaticByteField(java.lang.reflect.Field field)Get the value of a static byte field, ignoring visibility and bypassing security checks.- Parameters:
field- the static field- Returns:
- the static byte field
-
getStaticFloatField
public static float getStaticFloatField(java.lang.reflect.Field field)Get the value of a static float field, ignoring visibility and bypassing security checks.- Parameters:
field- the static field- Returns:
- the static float field
-
getStaticDoubleField
public static double getStaticDoubleField(java.lang.reflect.Field field)Get the value of a static double field, ignoring visibility and bypassing security checks.- Parameters:
field- the static field- Returns:
- the static double field
-
getStaticObjectField
public static java.lang.Object getStaticObjectField(java.lang.reflect.Field field)Get the value of a static object field, ignoring visibility and bypassing security checks.- Parameters:
field- the static field- Returns:
- the static object field
-
getStaticField
public static java.lang.Object getStaticField(java.lang.reflect.Field field)Get the value of a static field, ignoring visibility and bypassing security checks, boxing the value if necessary.- Parameters:
field- the static field- Returns:
- the static field
-
setStaticIntField
public static void setStaticIntField(java.lang.reflect.Field field, int val)Set the value of a static int field, ignoring visibility and bypassing security checks.- Parameters:
field- the static fieldval- the int value to set
-
setStaticLongField
public static void setStaticLongField(java.lang.reflect.Field field, long val)Set the value of a static long field, ignoring visibility and bypassing security checks.- Parameters:
field- the static fieldval- the long value to set
-
setStaticShortField
public static void setStaticShortField(java.lang.reflect.Field field, short val)Set the value of a static short field, ignoring visibility and bypassing security checks.- Parameters:
field- the static fieldval- the short value to set
-
setStaticCharField
public static void setStaticCharField(java.lang.reflect.Field field, char val)Set the value of a static char field, ignoring visibility and bypassing security checks.- Parameters:
field- the static fieldval- the char value to set
-
setStaticBooleanField
public static void setStaticBooleanField(java.lang.reflect.Field field, boolean val)Set the value of a static boolean field, ignoring visibility and bypassing security checks.- Parameters:
field- the static fieldval- the boolean value to set
-
setStaticByteField
public static void setStaticByteField(java.lang.reflect.Field field, byte val)Set the value of a static byte field, ignoring visibility and bypassing security checks.- Parameters:
field- the static fieldval- the byte value to set
-
setStaticFloatField
public static void setStaticFloatField(java.lang.reflect.Field field, float val)Set the value of a static float field, ignoring visibility and bypassing security checks.- Parameters:
field- the static fieldval- the float value to set
-
setStaticDoubleField
public static void setStaticDoubleField(java.lang.reflect.Field field, double val)Set the value of a static double field, ignoring visibility and bypassing security checks.- Parameters:
field- the static fieldval- the double value to set
-
setStaticObjectField
public static void setStaticObjectField(java.lang.reflect.Field field, java.lang.Object val)Set the value of a static object field, ignoring visibility and bypassing security checks.- Parameters:
field- the static fieldval- the value to set
-
setStaticField
public static void setStaticField(java.lang.reflect.Field field, java.lang.Object val)Set the value of a static field, ignoring visibility and bypassing security checks, unboxing the passed value if necessary.- Parameters:
field- the static fieldval- the value to set
-
invokeVoidMethod
public static void invokeVoidMethod(java.lang.Object object, java.lang.reflect.Method method, java.lang.Object... args)Invoke a non-static void-return-type method, ignoring visibility and bypassing security checks.- Parameters:
object- the object instance to invoke the method onmethod- the non-static methodargs- the method arguments (ornew Object[0]if there are no args)
-
invokeIntMethod
public static int invokeIntMethod(java.lang.Object object, java.lang.reflect.Method method, java.lang.Object... args)Invoke a non-static int-return-type method, ignoring visibility and bypassing security checks.- Parameters:
object- the object instance to invoke the method onmethod- the non-static methodargs- the method arguments (ornew Object[0]if there are no args)- Returns:
- the int return value
-
invokeLongMethod
public static long invokeLongMethod(java.lang.Object object, java.lang.reflect.Method method, java.lang.Object... args)Invoke a non-static long-return-type method, ignoring visibility and bypassing security checks.- Parameters:
object- the object instance to invoke the method onmethod- the non-static methodargs- the method arguments (ornew Object[0]if there are no args)- Returns:
- the long return value
-
invokeShortMethod
public static short invokeShortMethod(java.lang.Object object, java.lang.reflect.Method method, java.lang.Object... args)Invoke a non-static short-return-type method, ignoring visibility and bypassing security checks.- Parameters:
object- the object instance to invoke the method onmethod- the non-static methodargs- the method arguments (ornew Object[0]if there are no args)- Returns:
- the short return value
-
invokeCharMethod
public static char invokeCharMethod(java.lang.Object object, java.lang.reflect.Method method, java.lang.Object... args)Invoke a non-static char-return-type method, ignoring visibility and bypassing security checks.- Parameters:
object- the object instance to invoke the method onmethod- the non-static methodargs- the method arguments (ornew Object[0]if there are no args)- Returns:
- the char return value
-
invokeBooleanMethod
public static boolean invokeBooleanMethod(java.lang.Object object, java.lang.reflect.Method method, java.lang.Object... args)Invoke a non-static boolean-return-type method, ignoring visibility and bypassing security checks.- Parameters:
object- the object instance to invoke the method onmethod- the non-static methodargs- the method arguments (ornew Object[0]if there are no args)- Returns:
- the boolean return value
-
invokeByteMethod
public static byte invokeByteMethod(java.lang.Object object, java.lang.reflect.Method method, java.lang.Object... args)Invoke a non-static byte-return-type method, ignoring visibility and bypassing security checks.- Parameters:
object- the object instance to invoke the method onmethod- the non-static methodargs- the method arguments (ornew Object[0]if there are no args)- Returns:
- the byte return value
-
invokeFloatMethod
public static float invokeFloatMethod(java.lang.Object object, java.lang.reflect.Method method, java.lang.Object... args)Invoke a non-static float-return-type method, ignoring visibility and bypassing security checks.- Parameters:
object- the object instance to invoke the method onmethod- the non-static methodargs- the method arguments (ornew Object[0]if there are no args)- Returns:
- the float return value
-
invokeDoubleMethod
public static double invokeDoubleMethod(java.lang.Object object, java.lang.reflect.Method method, java.lang.Object... args)Invoke a non-static double-return-type method, ignoring visibility and bypassing security checks.- Parameters:
object- the object instance to invoke the method onmethod- the non-static methodargs- the method arguments (ornew Object[0]if there are no args)- Returns:
- the double return value
-
invokeObjectMethod
public static java.lang.Object invokeObjectMethod(java.lang.Object object, java.lang.reflect.Method method, java.lang.Object... args)Invoke a non-staticObject-return-type method, ignoring visibility and bypassing security checks.- Parameters:
object- the object instance to invoke the method onmethod- the non-static methodargs- the method arguments (ornew Object[0]if there are no args)- Returns:
- the return value
-
invokeMethod
public static java.lang.Object invokeMethod(java.lang.Object object, java.lang.reflect.Method method, java.lang.Object... args)Invoke a non-staticObject-return-type method, ignoring visibility and bypassing security checks, boxing the result if necessary.- Parameters:
object- the object instance to invoke the method onmethod- the non-static methodargs- the method arguments (ornew Object[0]if there are no args)- Returns:
- the return value (possibly a boxed value)
-
invokeStaticVoidMethod
public static void invokeStaticVoidMethod(java.lang.reflect.Method method, java.lang.Object... args)Invoke a static void-return-type method, ignoring visibility and bypassing security checks.- Parameters:
method- the static methodargs- the method arguments (ornew Object[0]if there are no args)
-
invokeStaticIntMethod
public static int invokeStaticIntMethod(java.lang.reflect.Method method, java.lang.Object... args)Invoke a static int-return-type method, ignoring visibility and bypassing security checks.- Parameters:
method- the static methodargs- the method arguments (ornew Object[0]if there are no args)- Returns:
- the int return value
-
invokeStaticLongMethod
public static long invokeStaticLongMethod(java.lang.reflect.Method method, java.lang.Object... args)Invoke a static long-return-type method, ignoring visibility and bypassing security checks.- Parameters:
method- the static methodargs- the method arguments (ornew Object[0]if there are no args)- Returns:
- the long return value
-
invokeStaticShortMethod
public static short invokeStaticShortMethod(java.lang.reflect.Method method, java.lang.Object... args)Invoke a static short-return-type method, ignoring visibility and bypassing security checks.- Parameters:
method- the static methodargs- the method arguments (ornew Object[0]if there are no args)- Returns:
- the short return value
-
invokeStaticCharMethod
public static char invokeStaticCharMethod(java.lang.reflect.Method method, java.lang.Object... args)Invoke a static char-return-type method, ignoring visibility and bypassing security checks.- Parameters:
method- the static methodargs- the method arguments (ornew Object[0]if there are no args)- Returns:
- the char return value
-
invokeStaticBooleanMethod
public static boolean invokeStaticBooleanMethod(java.lang.reflect.Method method, java.lang.Object... args)Invoke a static boolean-return-type method, ignoring visibility and bypassing security checks.- Parameters:
method- the static methodargs- the method arguments (ornew Object[0]if there are no args)- Returns:
- the boolean return value
-
invokeStaticByteMethod
public static byte invokeStaticByteMethod(java.lang.reflect.Method method, java.lang.Object... args)Invoke a static byte-return-type method, ignoring visibility and bypassing security checks.- Parameters:
method- the static methodargs- the method arguments (ornew Object[0]if there are no args)- Returns:
- the byte return value
-
invokeStaticFloatMethod
public static float invokeStaticFloatMethod(java.lang.reflect.Method method, java.lang.Object... args)Invoke a static float-return-type method, ignoring visibility and bypassing security checks.- Parameters:
method- the static methodargs- the method arguments (ornew Object[0]if there are no args)- Returns:
- the float return value
-
invokeStaticDoubleMethod
public static double invokeStaticDoubleMethod(java.lang.reflect.Method method, java.lang.Object... args)Invoke a static double-return-type method, ignoring visibility and bypassing security checks.- Parameters:
method- the static methodargs- the method arguments (ornew Object[0]if there are no args)- Returns:
- the double return value
-
invokeStaticObjectMethod
public static java.lang.Object invokeStaticObjectMethod(java.lang.reflect.Method method, java.lang.Object... args)Invoke a staticObject-return-type method, ignoring visibility and bypassing security checks.- Parameters:
method- the static methodargs- the method arguments (ornew Object[0]if there are no args)- Returns:
- the return value
-
invokeStaticMethod
public static java.lang.Object invokeStaticMethod(java.lang.reflect.Method method, java.lang.Object... args)Invoke a staticObject-return-type method, ignoring visibility and bypassing security checks, boxing the result if necessary.- Parameters:
method- the static methodargs- the method arguments (ornew Object[0]if there are no args)- Returns:
- the return value (possibly a boxed value)
-