Package com.kamikazejam.kamicommon.util
Class ReflectionUtil
java.lang.Object
com.kamikazejam.kamicommon.util.ReflectionUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Annotation>
TgetAnnotation
(Field field, Class<T> annotationClass) static <T> @NotNull Constructor
<T> getConstructor
(Class<?> clazz, Class<?>... parameterTypes) static <T> T
static @NotNull Field
static <T> T
static @NotNull Method
static @NotNull Method
static <T> T
getSingletonInstance
(@NotNull Class<?> clazz) static <T> T
getSingletonInstanceFirstCombatible
(Iterable<Class<?>> classes, T fallback) static Class
<?> getSuperclassDeclaringField
(@NotNull Class<?> clazz, boolean includeSelf, String fieldName) static Class
<?> getSuperclassDeclaringMethod
(@NotNull Class<?> clazz, boolean includeSelf, String methodName) getSuperclasses
(@NotNull Class<?> clazz, boolean includeSelf) static @Nullable Class
<?> getSuperclassPredicate
(@NotNull Class<?> clazz, boolean includeSelf, @NotNull Predicate<Class<?>> predicate) static <T> T
invokeMethod
(@NotNull Method method, @Nullable Object target) static <T> T
invokeMethod
(@NotNull Method method, @Nullable Object target, @Nullable Object argument) static <T> T
invokeMethod
(Method method, @Nullable Object target, Object... arguments) static boolean
isRawTypeAssignableFrom
(Type a, Type b) static boolean
isRawTypeAssignableFromAny
(Type goal, Type @NotNull ... subjects) static void
makeAccessible
(Constructor<?> constructor) static void
makeAccessible
(Field field) static void
makeAccessible
(Method method) static void
static void
-
Constructor Details
-
ReflectionUtil
public ReflectionUtil()
-
-
Method Details
-
getConstructor
@Contract("null, _ -> fail") @NotNull public static <T> @NotNull Constructor<T> getConstructor(Class<?> clazz, Class<?>... parameterTypes) -
makeAccessible
-
makeAccessible
-
makeAccessible
-
getSuperclassDeclaringMethod
-
getSuperclassDeclaringField
-
getSuperclassPredicate
-
getSuperclasses
-
getAnnotation
@Contract("null, _ -> fail; !null, null -> fail") @Nullable public static <T extends Annotation> T getAnnotation(Field field, Class<T> annotationClass) -
getSingletonInstance
-
getSingletonInstanceFirstCombatible
-
getMethod
-
getMethod
-
invokeMethod
-
invokeMethod
-
invokeMethod
-
isRawTypeAssignableFromAny
-
isRawTypeAssignableFrom
-
getField
-
getField
-
getField
-
setField
-
setField
-