public static RuntimeException toRuntime(Throwable throwable) { while (throwable instanceof InvocationTargetException || throwable instanceof ExecutionException || throwable instanceof MycilaGuiceException) throwable = throwable instanceof InvocationTargetException ? ((InvocationTargetException) throwable).getTargetException() : throwable.getCause(); if (throwable instanceof Error) throw (Error) throwable; if (throwable instanceof RuntimeException) return (RuntimeException) throwable; return new MycilaGuiceException(throwable); } }
public static RuntimeException toRuntime(Throwable throwable) { while (throwable instanceof InvocationTargetException || throwable instanceof ExecutionException || throwable instanceof MycilaGuiceException) throwable = throwable instanceof InvocationTargetException ? ((InvocationTargetException) throwable).getTargetException() : throwable.getCause(); if (throwable instanceof Error) throw (Error) throwable; if (throwable instanceof RuntimeException) return (RuntimeException) throwable; return new MycilaGuiceException(throwable); } }
public static RuntimeException toRuntime(Throwable throwable) { while (throwable instanceof InvocationTargetException || throwable instanceof ExecutionException || throwable instanceof MycilaGuiceException) throwable = throwable instanceof InvocationTargetException ? ((InvocationTargetException) throwable).getTargetException() : throwable.getCause(); if (throwable instanceof Error) throw (Error) throwable; if (throwable instanceof RuntimeException) return (RuntimeException) throwable; return new MycilaGuiceException(throwable); } }
private static Method findMethod(Class<?> declaring, String methodName, Key<?>... paramTypes) { try { return declaring.getMethod(methodName, toClasses(paramTypes)); } catch (NoSuchMethodException e) { Iterator<Method> methods = filter(Reflect.findAllMethods(declaring).iterator(), Reflect.withSignature(methodName, toClasses(paramTypes))); if (!methods.hasNext()) throw new MycilaGuiceException("Unable to find method " + methodName + " in class " + declaring.getName() + " matching given parameter types", e); return methods.next(); } }
private static Method findMethod(Class<?> declaring, String methodName, Key<?>... paramTypes) { try { return declaring.getMethod(methodName, toClasses(paramTypes)); } catch (NoSuchMethodException e) { Iterator<Method> methods = filter(Reflect.findAllMethods(declaring).iterator(), Reflect.withSignature(methodName, toClasses(paramTypes))); if (!methods.hasNext()) throw new MycilaGuiceException("Unable to find method " + methodName + " in class " + declaring.getName() + " matching given parameter types", e); return methods.next(); } }