@Override public void set(Instance<?> value) throws InvocationException { try { if (!field.isAccessible()) { field.setAccessible(true); } field.set(target, value); } catch (Exception e) { throw new InvocationException(e.getCause()); } } }
private void invokeObservers() { for (ObserverMethod observer : observers) { try { runtimeLogger.debug(observer, false); observer.invoke(manager, event); } catch (InvocationException e) { Throwable cause = e.getCause(); if (manager.isExceptionHandled(cause)) { UncheckedThrow.throwUnchecked(cause); } else { manager.fireException(cause); } } } }
private void invokeObservers() { for (ObserverMethod observer : observers) { try { runtimeLogger.debug(observer, false); observer.invoke(manager, event); } catch (InvocationException e) { Throwable cause = e.getCause(); if (manager.isExceptionHandled(cause)) { UncheckedThrow.throwUnchecked(cause); } else { manager.fireException(cause); } } } }
@Override public void set(Event<?> value) throws InvocationException { try { if (!field.isAccessible()) { field.setAccessible(true); } field.set(target, value); } catch (Exception e) { throw new InvocationException(e); } } }
@Override public void set(Instance<?> value) throws InvocationException { try { if (!field.isAccessible()) { field.setAccessible(true); } field.set(target, value); } catch (Exception e) { throw new InvocationException(e.getCause()); } } }
@Override public void set(Event<?> value) throws InvocationException { try { if (!field.isAccessible()) { field.setAccessible(true); } field.set(target, value); } catch (Exception e) { throw new InvocationException(e); } } }
@Override public boolean invoke(Manager manager, Object event) { try { Object[] arguments = resolveArguments(manager, event); if (containsNull(arguments)) { return false; } if (!method.isAccessible()) { method.setAccessible(true); } method.invoke(target, arguments); return true; } catch (Exception e) { if (e instanceof InvocationTargetException) { Throwable cause = ((InvocationTargetException) e).getTargetException(); // Exception already wrapped by another Observer down the chain. if (cause instanceof InvocationException) { throw (InvocationException) cause; } throw new InvocationException(cause); } throw new InvocationException(e); } }
@Override public boolean invoke(Manager manager, Object event) { try { Object[] arguments = resolveArguments(manager, event); if (containsNull(arguments)) { return false; } if (!method.isAccessible()) { method.setAccessible(true); } method.invoke(target, arguments); return true; } catch (Exception e) { if (e instanceof InvocationTargetException) { Throwable cause = ((InvocationTargetException) e).getTargetException(); // Exception already wrapped by another Observer down the chain. if (cause instanceof InvocationException) { throw (InvocationException) cause; } throw new InvocationException(cause); } throw new InvocationException(e); } }