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