com.adgear.anoa.Handler2 Maven / Gradle / Ivy
package com.adgear.anoa;
import java.util.Objects;
/**
* Functional interface for exception handlers with two extra arguments
*
* @param Metadata type
*/
public interface Handler2 {
/**
* Convenience factory method for transforming handlers which map an exception to a single
* meta-datum.
*
* @param mapToMetaDatum exception handler
* @param Metadata type
* @return an instance wrapping the result of {@code mapToMetaDatum} in an array.
*/
static /*@NonNull*/ Handler2 of(
/*@NonNull*/ TriFunction mapToMetaDatum) {
Objects.requireNonNull(mapToMetaDatum);
return (t, u, v) -> AnoaHandler.arraySize1(mapToMetaDatum.apply(t, u, v));
}
M[] apply(Throwable handled, Object value, Object other);
/**
* Functional interface for a function taking three arguments
*
* @param Value type of argument 1
* @param Value type of argument 2
* @param Value type of argument 3
* @param Value type of result
* @see java.util.function.BiFunction
*/
interface TriFunction {
R apply(T handled, U value, V other);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy