com.github.leeonky.util.Suppressor Maven / Gradle / Ivy
The newest version!
package com.github.leeonky.util;
import java.lang.reflect.InvocationTargetException;
public class Suppressor {
public static T get(ThrowingSupplier supplier) {
try {
return supplier.get();
} catch (RuntimeException e) {
throw e;
} catch (InvocationTargetException e) {
throw new InvocationException(e.getTargetException());
} catch (Throwable e) {
throw new IllegalStateException(e);
}
}
public static void run(ThrowingRunnable run) {
get(() -> {
run.run();
return null;
});
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy