com.github.markozajc.ef.triconsumer.except.EObjObjShortConsumer Maven / Gradle / Ivy
package com.github.markozajc.ef.triconsumer.except;
import static com.github.markozajc.ef.Utilities.asUnchecked;
import com.github.markozajc.ef.triconsumer.ObjObjShortConsumer;
/**
* Variant of {@link ObjObjShortConsumer} capable of throwing a generic
* {@link Throwable}.
*
* @author Marko Zajc
*
* @param
* the type of the first argument to the operation
* @param
* the type of the second argument to the operation
* @param
* {@link Throwable} type
*/
@FunctionalInterface
public interface EObjObjShortConsumer extends ObjObjShortConsumer {
@Override
default void accept(T t, U u, short p) {
try {
acceptChecked(t, u, p);
} catch (Throwable e) { // NOSONAR can't catch generic exceptions
throw asUnchecked(e);
}
}
/**
* Same as {@link #accept(Object, Object, short)}, but throws a checked exception.
*
* @param t
* the first input argument
* @param u
* the second input argument
* @param p
* the third ({$code short})input argument
*
* @throws E
* the defined exception type
*/
void acceptChecked(T t, U u, short p) throws E;
}