Package com.fastasyncworldedit.core.util
Class ReflectionUtils
java.lang.Object
com.fastasyncworldedit.core.util.ReflectionUtils
This is an internal class not meant to be used outside the FAWE internals.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Tstatic <T> TcallMethod(Method method, Object instance, Object... parameters) static <T> booleancompareAndSet(T[] array, T expectedValue, T newValue, int index) Performs CAS on the array element at the given index.static Class<?> static <T> Class<? extends T> static <T> Tstatic Objectstatic sun.misc.Unsafestatic MethodmakeMethod(Class<?> clazz, String methodName, Class<?>... parameters) static <T extends AccessibleObject>
TsetAccessible(T ao) static voidsetAccessibleNonFinal(Field field) static voidsetFailsafeFieldValue(Field field, Object target, Object value) static void
-
Constructor Details
-
ReflectionUtils
public ReflectionUtils()
-
-
Method Details
-
as
-
compareAndSet
public static <T> boolean compareAndSet(T[] array, T expectedValue, T newValue, int index) Performs CAS on the array element at the given index.- Type Parameters:
T- the type of elements in the array- Parameters:
array- the array in which to compare and set the valueexpectedValue- the value expected to be at the indexnewValue- the new value to be set at the index if the expected value matchesindex- the index at which to compare and set the value- Returns:
- true if the value at the index was successfully updated to the new value, false otherwise
- See Also:
-
setAccessibleNonFinal
-
setFailsafeFieldValue
public static void setFailsafeFieldValue(Field field, Object target, Object value) throws IllegalAccessException - Throws:
IllegalAccessException
-
getHandle
-
makeMethod
-
callMethod
-
setAccessible
-
getField
-
getClass
-
getClass
-
unsafeSet
-
getUnsafe
public static sun.misc.Unsafe getUnsafe()- Returns:
- an instance of
Unsafe
-