public class LongToIntFunctionChainer extends Chainer<LongToIntFunction,ThrowingLongToIntFunction,LongToIntFunctionChainer> implements ThrowingLongToIntFunction
Chainer.InstantiationException| Constructor and Description |
|---|
LongToIntFunctionChainer(ThrowingLongToIntFunction throwing) |
| Modifier and Type | Method and Description |
|---|---|
int |
doApplyAsInt(long value) |
LongToIntFunction |
fallbackTo(LongToIntFunction fallback)
Fall back to a non throwing instance if this instance fails
|
LongToIntFunction |
orReturn(int retval) |
<E extends RuntimeException> |
orThrow(Class<E> exclass)
Rethrow the exception using a custom (unchecked!) exception class if this
throwing instance fails
|
LongToIntFunctionChainer |
orTryWith(ThrowingLongToIntFunction other)
Try with another throwing instance if the first instance fails
|
LongToIntFunction |
sneakyThrow()
Sneaky throw of the exception thrown by the instance
|
doSneakyThrow, rethrowclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitapplyAsIntpublic LongToIntFunctionChainer(ThrowingLongToIntFunction throwing)
public int doApplyAsInt(long value)
throws Throwable
doApplyAsInt in interface ThrowingLongToIntFunctionThrowablepublic LongToIntFunctionChainer orTryWith(ThrowingLongToIntFunction other)
ChainerorTryWith in class Chainer<LongToIntFunction,ThrowingLongToIntFunction,LongToIntFunctionChainer>other - the other throwing instancepublic <E extends RuntimeException> ThrowingLongToIntFunction 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<LongToIntFunction,ThrowingLongToIntFunction,LongToIntFunctionChainer>E - type parameter of the exception classexclass - the exception classpublic LongToIntFunction fallbackTo(LongToIntFunction fallback)
ChainerfallbackTo in class Chainer<LongToIntFunction,ThrowingLongToIntFunction,LongToIntFunctionChainer>fallback - the fallback instancepublic LongToIntFunction sneakyThrow()
ChainerThis code was inspited by the Lombok project.
sneakyThrow in class Chainer<LongToIntFunction,ThrowingLongToIntFunction,LongToIntFunctionChainer>public LongToIntFunction orReturn(int retval)