feat(utils): 添加函数式接口和条件验证工具类

- 添加 RFunction 函数式接口用于无参数函数调用
- 更新文件头版权年份从 2025 到 2026
- 更新文件最后修改时间戳
- 新增 Require 类提供条件验证功能
- 支持多种构造方式包括布尔值、函数式参数等
- 提供多种异常抛出机制包括自定义异常类型
- 添加扩展函数和静态工厂方法简化使用
- 支持 Java 互操作性的 JvmStatic 注解
This commit is contained in:
2026-01-10 08:54:17 +08:00
parent 00c1be6387
commit 3f666d652d
2 changed files with 133 additions and 2 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2025 mingliqiye
* Copyright 2026 mingliqiye
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@
* ProjectName mingli-utils
* ModuleName mingli-utils.main
* CurrentFile Functions.kt
* LastUpdate 2025-09-15 09:56:54
* LastUpdate 2026-01-09 08:12:01
* UpdateUser MingLiPro
*/
@@ -85,6 +85,11 @@ fun interface P1Function<P> {
fun call(p: P)
}
@FunctionalInterface
fun interface RFunction<R> {
fun call(): R
}
@FunctionalInterface
fun interface P1RFunction<P, R> {
fun call(p: P): R