Class ReflectionUtil


public class ReflectionUtil extends Object
Provides utility methods that can be used access and mutate objects using reflection.
  • Method Details

    • setField

      public static boolean setField(@NonNull Object source, @NonNull String fieldName, @Nullable Object value)
    • assertCallerAnnotation

      public static void assertCallerAnnotation(Class<? extends Annotation> annotationClass, String message)
      Ensures if the caller of the method calling this method is annotated with the specified annotation.
      annotationClass - the expected annotation class
      message - the message that will included the exception if the check fails.
      UnsupportedOperationException - if the caller if the caller is not annotated as expected.