@FunctionalInterface @Generated(value="uk.kludje.annotation.processor.UncheckedFunctionalInterfaceProcessor") public interface USeptaFunction<A,B,C,D,E,F,G,R> extends SeptaFunction<A,B,C,D,E,F,G,R>
R $apply(A a, B b, C c, D d, E e, F f, G g) throws Throwable USING A LAMBDA; INVOKE R apply(A a, B b, C c, D d, E e, F f, G g).
A functional interface for handling checked exceptions. See parent type for interface intent.
R apply(A a, B b, C c, D d, E e, F f, G g) invokes R $apply(A a, B b, C c, D d, E e, F f, G g)
and throws anything thrown by R $apply(A a, B b, C c, D d, E e, F f, G g).
General example using java.lang.Runnable that reduces 11 lines to a single line.
Call someMethodThatThrowsException in throwsNothing:
public void someMethodThatThrowsException() throws IOException {
// I/O functionality
}
public void throwsNothing(Runnable r) {
r.run();
}
Before:
public void yourMethod() throws IOException {
try {
throwsNothing(() -> {
try {
someMethodThatThrowsException();
} catch (IOException e) {
throw new SomeWrapperException(e);
}
});
} catch(SomeWrapperException w) {
throw (IOException) w.getCause();
}
}
After:
public void yourMethod() throws IOException {
throwsNothing((URunnable) this::someMethodThatThrowsException);
}
Method public static <A, B, C, D, E, F, G, R> USeptaFunction<A, B, C, D, E, F, G, R> asUSeptaFunction(USeptaFunction<A, B, C, D, E, F, G, R> t)
provides a convenience method for manufacturing types as an alternative to casting.
| Modifier and Type | Method and Description |
|---|---|
R |
$apply(A a,
B b,
C c,
D d,
E e,
F f,
G g) |
default R |
apply(A a,
B b,
C c,
D d,
E e,
F f,
G g) |
static <A,B,C,D,E,F,G,R> |
asUSeptaFunction(USeptaFunction<A,B,C,D,E,F,G,R> t) |
R $apply(A a, B b, C c, D d, E e, F f, G g) throws java.lang.Throwable
java.lang.Throwablestatic <A,B,C,D,E,F,G,R> USeptaFunction<A,B,C,D,E,F,G,R> asUSeptaFunction(USeptaFunction<A,B,C,D,E,F,G,R> t)