com.adgear.anoa.Handler0 Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of anoa-core Show documentation
Show all versions of anoa-core Show documentation
Core classes for Anoa library, which aims to be a safe, convenient and fast record
de/serialization wrapper for the Avro, Thrift and Jackson libraries, using the functional idioms
of Java 8.
The anoa-core module tries to keep upstream dependencies to a minimum.
package com.adgear.anoa;
import java.util.Objects;
import java.util.function.Function;
/**
* Functional interface for exception handlers with no extra arguments
*
* @param Metadata type
*/
public interface Handler0 extends Function {
/**
* 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*/ Handler0 of(
/*@NonNull*/ Function mapToMetaDatum) {
Objects.requireNonNull(mapToMetaDatum);
return t -> AnoaHandler.arraySize1(mapToMetaDatum.apply(t));
}
}