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