1
mirror of https://github.com/CarmJos/EasySQL.git synced 2026-06-05 00:25:32 +08:00

修改代码演示的位置

This commit is contained in:
2021-12-14 17:24:45 +08:00
parent 85d2ee8984
commit 2d384bdd15
7 changed files with 207 additions and 65 deletions
@@ -7,6 +7,7 @@ import java.sql.SQLException;
import java.util.UUID;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
public interface SQLAction<T> {
@@ -22,6 +23,13 @@ public interface SQLAction<T> {
@NotNull T execute() throws SQLException;
@Nullable
default <R> R execute(@NotNull Function<T, R> function, @Nullable BiConsumer<SQLException, SQLAction<T>> exceptionHandler) {
T value = execute(exceptionHandler);
if (value == null) return null;
else return function.apply(value);
}
@Nullable
default T execute(@Nullable BiConsumer<SQLException, SQLAction<T>> exceptionHandler) {
if (exceptionHandler == null) exceptionHandler = defaultExceptionHandler();