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