R
- return typeE
- exception typeP
- parameter type@FunctionalInterface
public interface FragileFunction1<R,E extends java.lang.Exception,P>
Modifier and Type | Method and Description |
---|---|
R |
apply(P arg)
Run the function.
|
default Function1<R,P> |
nonFragile()
Convert this to a non-fragile function which does not throw a checked exception.
|
default Function1<R,P> |
nonFragile(R fallback)
Convert this to a non-fragile function which does not throw a checked exception.
|
default Function1<R,P> |
nonFragileX(java.util.function.BiFunction<? super E,? super P,? extends R> exceptionHandler)
Convert this to a non-fragile function which does not throw a checked exception.
|
R apply(P arg) throws E extends java.lang.Exception
arg
- function argumentE
- typed exceptionE extends java.lang.Exception
@NotNull default Function1<R,P> nonFragile()
WrappedFragileException
for any
checked exception thrown during apply(Object)
.Function1.nonFragile(FragileFunction1)
@NotNull default Function1<R,P> nonFragile(R fallback)
fallback
value.
Please note that in this case the exception is completely lost!fallback
- fallback valueFunction1.nonFragile(FragileFunction1, Object)
@NotNull default Function1<R,P> nonFragileX(@NotNull java.util.function.BiFunction<? super E,? super P,? extends R> exceptionHandler)
exceptionHandler
- handler which can handle the exception how it sees fit.
E.g. throw an unchecked exception (compare nonFragile()
,
return a fallback (compare nonFragile(Object)
),
or do the latter but also log or collect the exceptionFunction1.nonFragileX(FragileFunction1, BiFunction)