public class ObjLongConsumerChainer<T> extends Chainer<ObjLongConsumer<T>,ThrowingObjLongConsumer<T>,ObjLongConsumerChainer<T>> implements ThrowingObjLongConsumer<T>
Chainer.InstantiationException| Constructor and Description |
|---|
ObjLongConsumerChainer(ThrowingObjLongConsumer<T> throwing) |
| Modifier and Type | Method and Description |
|---|---|
void |
doAccept(T t,
long value) |
ObjLongConsumer<T> |
fallbackTo(ObjLongConsumer<T> fallback)
Fall back to a non throwing instance if this instance fails
|
ObjLongConsumer<T> |
orDoNothing() |
<E extends RuntimeException> |
orThrow(Class<E> exclass)
Rethrow the exception using a custom (unchecked!) exception class if this
throwing instance fails
|
ObjLongConsumerChainer<T> |
orTryWith(ThrowingObjLongConsumer<T> other)
Try with another throwing instance if the first instance fails
|
ObjLongConsumer<T> |
sneakyThrow()
Sneaky throw of the exception thrown by the instance
|
doSneakyThrow, rethrowclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitacceptpublic ObjLongConsumerChainer(ThrowingObjLongConsumer<T> throwing)
public void doAccept(T t, long value) throws Throwable
doAccept in interface ThrowingObjLongConsumer<T>Throwablepublic ObjLongConsumerChainer<T> orTryWith(ThrowingObjLongConsumer<T> other)
ChainerorTryWith in class Chainer<ObjLongConsumer<T>,ThrowingObjLongConsumer<T>,ObjLongConsumerChainer<T>>other - the other throwing instancepublic <E extends RuntimeException> ThrowingObjLongConsumer<T> orThrow(Class<E> exclass)
ChainerYour custom exception class must have a constructor
accepting a single Throwable as an argument.
The original exception thrown will be the cause of the generated exception.
All instances of Error or RuntimeException thrown by
the instance are thrown as is.
orThrow in class Chainer<ObjLongConsumer<T>,ThrowingObjLongConsumer<T>,ObjLongConsumerChainer<T>>E - type parameter of the exception classexclass - the exception classpublic ObjLongConsumer<T> fallbackTo(ObjLongConsumer<T> fallback)
ChainerfallbackTo in class Chainer<ObjLongConsumer<T>,ThrowingObjLongConsumer<T>,ObjLongConsumerChainer<T>>fallback - the fallback instancepublic ObjLongConsumer<T> sneakyThrow()
ChainerThis code was inspited by the Lombok project.
sneakyThrow in class Chainer<ObjLongConsumer<T>,ThrowingObjLongConsumer<T>,ObjLongConsumerChainer<T>>public ObjLongConsumer<T> orDoNothing()