package eu.dnetlib.dhp.common; import java.io.Serializable; import java.util.function.Consumer; import java.util.function.Supplier; /** Provides serializable and throwing extensions to standard functional interfaces. */ public class FunctionalInterfaceSupport { private FunctionalInterfaceSupport() { } /** * Serializable consumer of any kind of objects. To be used withing spark processing pipelines when supplying * functions externally. * * @param */ @FunctionalInterface public interface SerializableConsumer extends Consumer, Serializable { } /** * Serializable supplier of any kind of objects. To be used withing spark processing pipelines when supplying * functions externally. * * @param */ @FunctionalInterface public interface SerializableSupplier extends Supplier, Serializable { } /** * Extension of consumer accepting functions throwing an exception. * * @param * @param */ @FunctionalInterface public interface ThrowingConsumer { void accept(T t) throws E; } /** * Extension of supplier accepting functions throwing an exception. * * @param * @param */ @FunctionalInterface public interface ThrowingSupplier { T get() throws E; } /** * Extension of runnable accepting functions throwing an exception. * * @param */ @FunctionalInterface public interface ThrowingRunnable { void run() throws E; } }