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