public void accept(final ExceptionConsumer<Object, E> consumer, final Object o) throws E { consumer.accept(o); } }
public void run() throws E { consumer.accept(param); }
@Override public void start(StartContext context) throws StartException { if (this.starter != null) { try { this.starter.accept(context); } catch (RuntimeException | Error e) { throw new StartException(e); } } }
default ExceptionRunnable<E> compose(ExceptionSupplier<? extends T, ? extends E> before) { Assert.checkNotNullParam("before", before); return () -> accept(before.get()); } }
private void executeAndInvalidate(ExceptionConsumer<ModifiableRealmIdentity, RealmUnavailableException> operation) throws RealmUnavailableException { try { operation.accept(modifiable); } catch (RealmUnavailableException rue) { throw rue; } finally { removeFromCache(modifiable.getRealmIdentityPrincipal()); } } };
default ExceptionRunnable<E> andThen(ExceptionConsumer<? super T, ? extends E> after) { Assert.checkNotNullParam("after", after); return () -> after.accept(get()); }
default ExceptionBiConsumer<T, U, E> andThen(ExceptionConsumer<R, ? extends E> after) { Assert.checkNotNullParam("after", after); return (t, u) -> after.accept(apply(t, u)); }
default ExceptionConsumer<T, E> andThen(ExceptionConsumer<? super R, ? extends E> after) { Assert.checkNotNullParam("after", after); return t -> after.accept(apply(t)); }
/** * Run the given task with this contextual object selected. * * @param consumer the task to run (must not be {@code null}) * @param param the parameter to pass to the task * @param <T> the parameter type * @param <E> the exception type * @throws E if an exception occurs in the task */ default <T, E extends Exception> void runExConsumer(ExceptionConsumer<T, E> consumer, T param) throws E { final ContextManager<C> contextManager = getInstanceContextManager(); final C old = contextManager.getAndSetCurrent(this); try { consumer.accept(param); } finally { contextManager.restoreCurrent(old); } }
@Override public void start(StartContext context) throws StartException { if (this.startTask != null) { this.startTask.accept(context); } }
@Override public void start(StartContext context) throws StartException { if (this.starter != null) { try { this.starter.accept(context); } catch (RuntimeException | Error e) { throw new StartException(e); } } }
default ExceptionRunnable<E> compose(ExceptionSupplier<? extends T, ? extends E> before) { Assert.checkNotNullParam("before", before); return () -> accept(before.get()); } }
private void executeAndInvalidate(ExceptionConsumer<ModifiableRealmIdentity, RealmUnavailableException> operation) throws RealmUnavailableException { try { operation.accept(modifiable); } catch (RealmUnavailableException rue) { throw rue; } finally { removeFromCache(modifiable.getRealmIdentityPrincipal()); } } };
private void executeAndInvalidate(ExceptionConsumer<ModifiableRealmIdentity, RealmUnavailableException> operation) throws RealmUnavailableException { try { operation.accept(modifiable); } catch (RealmUnavailableException rue) { throw rue; } finally { removeFromCache(modifiable.getRealmIdentityPrincipal()); } } };
private void executeAndInvalidate(ExceptionConsumer<ModifiableRealmIdentity, RealmUnavailableException> operation) throws RealmUnavailableException { try { operation.accept(modifiable); } catch (RealmUnavailableException rue) { throw rue; } finally { removeFromCache(modifiable.getRealmIdentityPrincipal()); } } };
default ExceptionRunnable<E> compose(ExceptionSupplier<? extends T, ? extends E> before) { Assert.checkNotNullParam("before", before); return () -> accept(before.get()); } }