All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.markozajc.ef.biconsumer.except.EObjByteConsumer Maven / Gradle / Ivy

package com.github.markozajc.ef.biconsumer.except;

import static com.github.markozajc.ef.Utilities.asUnchecked;

import com.github.markozajc.ef.biconsumer.ObjByteConsumer;

/**
 * Variant of {@link ObjByteConsumer} capable of throwing a generic
 * {@link Throwable}.
 *
 * @author Marko Zajc
 *
 * @param 
 *            the type of the first argument to the operation
 * @param 
 *            {@link Throwable} type
 */
@FunctionalInterface
public interface EObjByteConsumer extends ObjByteConsumer {

	@Override
	default void accept(T t, byte p) {
		try {
			acceptChecked(t, p);
		} catch (Throwable e) { // NOSONAR can't catch generic exceptions
			throw asUnchecked(e);
		}
	}

	/**
	 * Same as {@link #accept(Object, byte)}, but throws a checked exception.
	 *
	 * @param t
	 *            the first input argument
	 * @param p
	 *            the second ({$code byte})input argument
	 *
	 * @throws E
	 *             the defined exception type
	 */
	void acceptChecked(T t, byte p) throws E;

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy