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

com.adgear.anoa.Handler1 Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 3.1.2
Show newest version
package com.adgear.anoa;

import java.util.Objects;
import java.util.function.BiFunction;


/**
 * Functional interface for exception handlers with one extra argument
 *
 * @param  Metadata type
 */
public interface Handler1 extends BiFunction {

  /**
   * 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*/ Handler1 of(
      /*@NonNull*/ BiFunction mapToMetaDatum) {
    Objects.requireNonNull(mapToMetaDatum);
    return (t, u) -> AnoaHandler.arraySize1(mapToMetaDatum.apply(t, u));
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy