diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/function/CheckedCallable.java b/blade-core-tool/src/main/java/org/springblade/core/tool/function/CheckedCallable.java new file mode 100644 index 0000000..12828c6 --- /dev/null +++ b/blade-core-tool/src/main/java/org/springblade/core/tool/function/CheckedCallable.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2019-2029, Dreamlu 卢春梦 (596392912@qq.com & www.dreamlu.net). + *
+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0; + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *
+ * http://www.gnu.org/licenses/lgpl.html + *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springblade.core.tool.function;
+
+import org.springframework.lang.Nullable;
+
+import java.io.Serializable;
+
+/**
+ * 受检的 Callable
+ *
+ * @author L.cm
+ */
+@FunctionalInterface
+public interface CheckedCallable
+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.gnu.org/licenses/lgpl.html
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springblade.core.tool.function;
+
+import java.io.Serializable;
+
+/**
+ * 受检的 Comparator
+ *
+ * @author L.cm
+ */
+@FunctionalInterface
+public interface CheckedComparator
+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.gnu.org/licenses/lgpl.html
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springblade.core.tool.function;
+
+import org.springframework.lang.Nullable;
+
+import java.io.Serializable;
+
+/**
+ * 受检的 Consumer
+ *
+ * @author L.cm
+ */
+@FunctionalInterface
+public interface CheckedConsumer
+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.gnu.org/licenses/lgpl.html
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springblade.core.tool.function;
+
+import org.springframework.lang.Nullable;
+
+import java.io.Serializable;
+
+/**
+ * 受检的 function
+ *
+ * @author L.cm
+ */
+@FunctionalInterface
+public interface CheckedFunction
+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.gnu.org/licenses/lgpl.html
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springblade.core.tool.function;
+
+import java.io.Serializable;
+
+/**
+ * 受检的 Predicate
+ *
+ * @author L.cm
+ */
+@FunctionalInterface
+public interface CheckedPredicate
+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.gnu.org/licenses/lgpl.html
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springblade.core.tool.function;
+
+import java.io.Serializable;
+
+/**
+ * 受检的 runnable
+ *
+ * @author L.cm
+ */
+@FunctionalInterface
+public interface CheckedRunnable extends Serializable {
+
+ /**
+ * Run this runnable.
+ *
+ * @throws Throwable CheckedException
+ */
+ void run() throws Throwable;
+
+}
diff --git a/blade-core-tool/src/main/java/org/springblade/core/tool/function/CheckedSupplier.java b/blade-core-tool/src/main/java/org/springblade/core/tool/function/CheckedSupplier.java
new file mode 100644
index 0000000..dbdae1e
--- /dev/null
+++ b/blade-core-tool/src/main/java/org/springblade/core/tool/function/CheckedSupplier.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2019-2029, Dreamlu 卢春梦 (596392912@qq.com & www.dreamlu.net).
+ *
+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.gnu.org/licenses/lgpl.html
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springblade.core.tool.function;
+
+import org.springframework.lang.Nullable;
+
+import java.io.Serializable;
+
+/**
+ * 受检的 Supplier
+ *
+ * @author L.cm
+ */
+@FunctionalInterface
+public interface CheckedSupplier
+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.gnu.org/licenses/lgpl.html
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springblade.core.tool.utils;
+
+
+import org.springblade.core.tool.function.*;
+
+import java.util.Comparator;
+import java.util.Objects;
+import java.util.concurrent.Callable;
+import java.util.function.Consumer;
+import java.util.function.Function;
+import java.util.function.Predicate;
+import java.util.function.Supplier;
+
+/**
+ * Lambda 受检异常处理
+ *
+ *
+ * https://segmentfault.com/a/1190000007832130
+ * https://github.com/jOOQ/jOOL
+ *