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 MycilaGuiceException(Throwable cause) { super(cause.getMessage(), cause); setStackTrace(cause.getStackTrace()); }
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 MycilaGuiceException(Throwable cause) { super(cause.getMessage(), cause); setStackTrace(cause.getStackTrace()); }
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 MycilaGuiceException(Throwable cause) { super(cause.getMessage(), cause); setStackTrace(cause.getStackTrace()); }
public static MethodInvoker on(Method method) { try { return INVOKERS.get(method); } catch (ExecutionException e) { throw MycilaGuiceException.toRuntime(e); } }
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(); } }
public static MethodInvoker on(Method method) { try { return INVOKERS.get(method); } catch (ExecutionException e) { throw MycilaGuiceException.toRuntime(e); } }
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(); } }
public static MethodInvoker on(Method method) { try { return INVOKERS.get(method); } catch (ExecutionException e) { throw MycilaGuiceException.toRuntime(e); } }
public static Iterable<Method> findAllMethods(Class<?> type) { try { return transform(METHODS.get(type), TO_METHOD); } catch (ExecutionException e) { throw MycilaGuiceException.toRuntime(e); } }
public static Iterable<Method> findAllMethods(Class<?> type) { try { return transform(METHODS.get(type), TO_METHOD); } catch (ExecutionException e) { throw MycilaGuiceException.toRuntime(e); } }
public static Iterable<Method> findAllMethods(Class<?> type) { try { return transform(METHODS.get(type), TO_METHOD); } catch (ExecutionException e) { throw MycilaGuiceException.toRuntime(e); } }
@Override public T get(Injector injector) { try { if (!constructor.isAccessible()) constructor.setAccessible(true); return constructor.newInstance(getParameterValues(injector)); } catch (Exception e) { throw MycilaGuiceException.toRuntime(e); } } }
@Override public T get(Injector injector) { try { if (!constructor.isAccessible()) constructor.setAccessible(true); return constructor.newInstance(getParameterValues(injector)); } catch (Exception e) { throw MycilaGuiceException.toRuntime(e); } } }
@Override public T get(Injector injector) { Object factory = Modifier.isStatic(method.getModifiers()) ? null : injector.getInstance(factoryKey); try { return providedType.cast(MethodInvoker.on(method).invoke(factory, getParameterValues(injector))); } catch (Exception e) { throw MycilaGuiceException.toRuntime(e); } } }