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

com.github.markozajc.ef.tripredicate.except.EObjObjBooleanPredicate Maven / Gradle / Ivy

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

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

import com.github.markozajc.ef.tripredicate.ObjObjBooleanPredicate;

/**
 * Variant of {@link ObjObjBooleanPredicate} capable of throwing a generic
 * {@link Throwable}.
 *
 * @author Marko Zajc
 *
 * @param 
 *            the type of the first argument to the predicate
 * @param 
 *            the type of the second argument the predicate
 * @param 
 *            {@link Throwable} type
 */
@FunctionalInterface
public interface EObjObjBooleanPredicate extends ObjObjBooleanPredicate {

	@Override
	default boolean test(T t, U u, boolean p) {
		try {
			return testChecked(t, u, p);
		} catch (Throwable e) { // NOSONAR can't catch generic exceptions
			throw asUnchecked(e);
		}
	}

	/**
	 * Same as {@link #test(Object, Object, boolean)}, but throws a checked exception.
	 *
	 * @param t
	 *            the first input argument
	 * @param u
	 *            the second input argument
	 * @param p
	 *            the third ({@code boolean}) input argument
	 *
	 * @return {@code true} if the input arguments match the predicate, otherwise
	 *         {@code false}
	 *
	 * @throws E
	 *             the defined exception type
	 */
	boolean testChecked(T t, U u, boolean p) throws E;

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy