public static Runnable asRunnable ( Class < ? > clazz , String methodName ) { Method method = findMethod ( clazz , methodName ) ; if ( ! Modifier . isStatic ( method . getModifiers ( ) ) ) { throw new IllegalArgumentException ( clazz . getName ( ) + "." + methodName + "() must be static" ) ; } return new MethodRunner ( method , null ) ; }
Creates a runnable that invokes the specified static method via reflection .