io.swagger.swaggerhub.interfaces.ExceptionThrowingConsumer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of swaggerhub-maven-plugin
Show all versions of swaggerhub-maven-plugin
A maven plugin for downloading and uploading Swagger/OAS definitions from/to SwaggerHub as
part of a build process.
package io.swagger.swaggerhub.interfaces;
import java.util.function.Consumer;
/**
* Consumer used throw an exception from the given function
* @see https://www.baeldung.com/java-lambda-exceptions
* @param
* @param
*/
@FunctionalInterface
public interface ExceptionThrowingConsumer {
void accept(T t) throws E;
/**
* Consumer wrapper that catches a thrown exception and wraps that in a Runtime Exception.
* @param exceptionThrowingConsumer
* @param
* @return
*/
static Consumer RuntimeThrowingConsumerWrapper(
ExceptionThrowingConsumer exceptionThrowingConsumer) {
return i -> {
try {
exceptionThrowingConsumer.accept(i);
} catch (Exception ex) {
throw new RuntimeException(ex);
}
};
}
} © 2015 - 2025 Weber Informatics LLC | Privacy Policy