com.blade.jdbc.utils.Unchecked Maven / Gradle / Ivy
package com.blade.jdbc.utils;
import java.util.concurrent.Callable;
import java.util.function.Consumer;
/**
* Created by biezhi on 03/07/2017.
*/
public class Unchecked {
public static T wrap(Callable callable) {
try {
return callable.call();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
public static void wrap(T t, Consumer consumer) {
try {
consumer.accept(t);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}