Class Methods


  • public final class Methods
    extends java.lang.Object
    Utility methods related to Method.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <R,​EX extends java.lang.Throwable>
      R
      invoke​(java.lang.reflect.Method method, java.lang.Object obj, java.lang.Object... args)
      A wrapper for method.invoke(obj, args) that catches any exception, wraps it in an AssertionError, and throws that.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • invoke

        public static <R,​EX extends java.lang.Throwable> R invoke​(java.lang.reflect.Method method,
                                                                        @Nullable
                                                                        java.lang.Object obj,
                                                                        java.lang.Object... args)
                                                                 throws EX extends java.lang.Throwable
        A wrapper for method.invoke(obj, args) that catches any exception, wraps it in an AssertionError, and throws that.
        Throws:
        T - The method threw that exception
        java.lang.ClassCastException - The method threw an unchecked exception that is not a subclass of EX
        java.lang.ClassCastException - The method returned a value that is not a subclass of R
        EX extends java.lang.Throwable