@Override public void doAccept(final T t, final U u) throws Throwable { throwing.doAccept(t, u); }
private void doMapping(Request request, ThrowingBiConsumer<MappingSource, Domain> mappingOperation) { MappingSource fromDomain = mappingSourceFrom(request); Domain toDomain = createDomainOrThrow().apply(request.body()); mappingOperation.accept(fromDomain, toDomain); }
@Override public void doAccept(final T t, final U u) throws Throwable { throwing.doAccept(t, u); }
public BiConsumer<T, U> orDoNothing() { return (t, u) -> { try { throwing.doAccept(t, u); } catch (Error | RuntimeException e) { throw e; } catch (Throwable ignored) { // nothing } }; } }
public BiConsumer<T, U> orDoNothing() { return (t, u) -> { try { throwing.doAccept(t, u); } catch (Error | RuntimeException e) { throw e; } catch (Throwable ignored) { // nothing } }; } }
@Override public BiConsumer<T, U> fallbackTo(final BiConsumer<T, U> fallback) { return (t, u) -> { try { throwing.doAccept(t, u); } catch (Error | RuntimeException e) { throw e; } catch (Throwable ignored) { fallback.accept(t, u); } }; }
@Override public BiConsumer<T, U> fallbackTo(final BiConsumer<T, U> fallback) { return (t, u) -> { try { throwing.doAccept(t, u); } catch (Error | RuntimeException e) { throw e; } catch (Throwable ignored) { fallback.accept(t, u); } }; }
@Override public BiConsumerChainer<T, U> orTryWith(final ThrowingBiConsumer<T, U> other) { final ThrowingBiConsumer<T, U> consumer = (t, u) -> { try { throwing.doAccept(t, u); } catch (Error | RuntimeException e) { throw e; } catch (Throwable ignored) { other.doAccept(t, u); } }; return new BiConsumerChainer<>(consumer); }
@Override public BiConsumerChainer<T, U> orTryWith(final ThrowingBiConsumer<T, U> other) { final ThrowingBiConsumer<T, U> consumer = (t, u) -> { try { throwing.doAccept(t, u); } catch (Error | RuntimeException e) { throw e; } catch (Throwable ignored) { other.doAccept(t, u); } }; return new BiConsumerChainer<>(consumer); }
@Override default void accept(T t, U u) { try { doAccept(t, u); } catch (Error | RuntimeException e) { throw e; } catch (Throwable throwable) { throw new ThrownByLambdaException(throwable); } } }
@Override default void accept(T t, U u) { try { doAccept(t, u); } catch (Error | RuntimeException e) { throw e; } catch (Throwable throwable) { throw new ThrownByLambdaException(throwable); } } }
@Override public <E extends RuntimeException> ThrowingBiConsumer<T, U> orThrow( final Class<E> exclass) { return (t, u) -> { try { throwing.doAccept(t, u); } catch (Error | RuntimeException e) { throw e; } catch (Throwable throwable) { throw rethrow(exclass, throwable); } }; }
@Override public BiConsumer<T, U> sneakyThrow() { return (t, u) -> { try { throwing.doAccept(t, u); } catch (Error | RuntimeException e) { throw e; } catch (Throwable throwable) { throw doSneakyThrow(throwable); } }; }
@Override public BiConsumer<T, U> sneakyThrow() { return (t, u) -> { try { throwing.doAccept(t, u); } catch (Error | RuntimeException e) { throw e; } catch (Throwable throwable) { throw doSneakyThrow(throwable); } }; }
@Override public <E extends RuntimeException> ThrowingBiConsumer<T, U> orThrow( final Class<E> exclass) { return (t, u) -> { try { throwing.doAccept(t, u); } catch (Error | RuntimeException e) { throw e; } catch (Throwable throwable) { throw rethrow(exclass, throwable); } }; }
@Override protected void configureAlternate( final ThrowingBiConsumer<Type1, Type2> throwing) throws Throwable { doAnswer(invocation -> { sentinel.set(ret2); return null; }) .when(throwing).doAccept(t, u); }
@Override protected void configureFull( final ThrowingBiConsumer<Type1, Type2> throwing) throws Throwable { doAnswer(invocation -> { sentinel.set(ret1); return null; }) .doThrow(checked) .doThrow(unchecked) .doThrow(error) .when(throwing).doAccept(t, u); }