Class ReflectionUtil

java.lang.Object
com.kamikazejam.kamicommon.util.ReflectionUtil

public class ReflectionUtil extends Object
  • Constructor Details

    • ReflectionUtil

      public ReflectionUtil()
  • Method Details

    • getConstructor

      @Contract("null, _ -> fail") @NotNull public static <T> @NotNull Constructor<T> getConstructor(Class<?> clazz, Class<?>... parameterTypes)
    • makeAccessible

      @Contract("null -> fail") public static void makeAccessible(Field field)
    • makeAccessible

      @Contract("null -> fail") public static void makeAccessible(Constructor<?> constructor)
    • makeAccessible

      @Contract("null -> fail") public static void makeAccessible(Method method)
    • getSuperclassDeclaringMethod

      public static Class<?> getSuperclassDeclaringMethod(@NotNull @NotNull Class<?> clazz, boolean includeSelf, String methodName)
    • getSuperclassDeclaringField

      public static Class<?> getSuperclassDeclaringField(@NotNull @NotNull Class<?> clazz, boolean includeSelf, String fieldName)
    • getSuperclassPredicate

      @Nullable public static @Nullable Class<?> getSuperclassPredicate(@NotNull @NotNull Class<?> clazz, boolean includeSelf, @NotNull @NotNull Predicate<Class<?>> predicate)
    • getSuperclasses

      @NotNull public static @NotNull List<Class<?>> getSuperclasses(@NotNull @NotNull Class<?> clazz, boolean includeSelf)
    • getAnnotation

      @Contract("null, _ -> fail; !null, null -> fail") @Nullable public static <T extends Annotation> T getAnnotation(Field field, Class<T> annotationClass)
    • getSingletonInstance

      @NotNull public static <T> T getSingletonInstance(@NotNull @NotNull Class<?> clazz)
    • getSingletonInstanceFirstCombatible

      public static <T> T getSingletonInstanceFirstCombatible(Iterable<Class<?>> classes, T fallback)
    • getMethod

      @Contract("null, _, _ -> fail; !null, null, _ -> fail") @NotNull public static @NotNull Method getMethod(Class<?> clazz, String name, @NotNull @NotNull Class<?>... parameterTypes)
    • getMethod

      @NotNull public static @NotNull Method getMethod(@NotNull @NotNull Class<?> clazz, @NotNull @NotNull String name)
    • invokeMethod

      @Contract("null, _, _ -> fail") public static <T> T invokeMethod(Method method, @Nullable @Nullable Object target, Object... arguments)
    • invokeMethod

      public static <T> T invokeMethod(@NotNull @NotNull Method method, @Nullable @Nullable Object target, @Nullable @Nullable Object argument)
    • invokeMethod

      public static <T> T invokeMethod(@NotNull @NotNull Method method, @Nullable @Nullable Object target)
    • isRawTypeAssignableFromAny

      public static boolean isRawTypeAssignableFromAny(Type goal, Type @NotNull ... subjects)
    • isRawTypeAssignableFrom

      @Contract("null, _ -> false; !null, null -> false") public static boolean isRawTypeAssignableFrom(Type a, Type b)
    • getField

      @Contract("null, _ -> fail; !null, null -> fail") @NotNull public static @NotNull Field getField(Class<?> clazz, String name)
    • getField

      public static <T> T getField(@NotNull @NotNull Field field, Object object)
    • getField

      public static <T> T getField(@NotNull @NotNull Class<?> clazz, @NotNull @NotNull String name, Object object)
    • setField

      public static void setField(@NotNull @NotNull Class<?> clazz, @NotNull @NotNull String name, Object object, Object value)
    • setField

      public static void setField(@NotNull @NotNull Field field, Object object, Object value)