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