fix comment

This commit is contained in:
Looly 2025-03-31 15:23:08 +08:00
parent 1b29100fb3
commit 4589d5fb84

View File

@ -40,6 +40,13 @@ public class VersionUtil {
return matchEl(currentVersion, CollUtil.join(compareVersions, defaultVersionsDelimiter)); return matchEl(currentVersion, CollUtil.join(compareVersions, defaultVersionsDelimiter));
} }
/**
* 是否匹配任意一个版本
*
* @param currentVersion 当前版本
* @param compareVersions 待匹配的版本列表
* @return true 包含待匹配的版本
*/
public static boolean anyMatch(String currentVersion, String... compareVersions) { public static boolean anyMatch(String currentVersion, String... compareVersions) {
return matchEl(currentVersion, ArrayUtil.join(compareVersions, defaultVersionsDelimiter)); return matchEl(currentVersion, ArrayUtil.join(compareVersions, defaultVersionsDelimiter));
} }
@ -90,13 +97,13 @@ public class VersionUtil {
/** /**
* 当前版本是否满足版本表达式 * 当前版本是否满足版本表达式
* <pre> * <pre>{@code
* matchEl("1.0.2", ">=1.0.2") == true * matchEl("1.0.2", ">=1.0.2") == true
* matchEl("1.0.2", "<1.0.1;1.0.2") == true * matchEl("1.0.2", "<1.0.1;1.0.2") == true
* matchEl("1.0.2", "<1.0.2") == false * matchEl("1.0.2", "<1.0.2") == false
* matchEl("1.0.2", "1.0.0-1.1.1") == true * matchEl("1.0.2", "1.0.0-1.1.1") == true
* matchEl("1.0.2", "1.0.0-1.1.1") == true * matchEl("1.0.2", "1.0.0-1.1.1") == true
* </pre> * }</pre>
* *
* @param currentVersion 当前本本 * @param currentVersion 当前本本
* @param versionEl 版本表达式 * @param versionEl 版本表达式
@ -108,13 +115,13 @@ public class VersionUtil {
/** /**
* 当前版本是否满足版本表达式 * 当前版本是否满足版本表达式
* <pre> * <pre>{@code
* matchEl("1.0.2", ">=1.0.2", ";") == true * matchEl("1.0.2", ">=1.0.2", ";") == true
* matchEl("1.0.2", "<1.0.1,1.0.2", ",") == true * matchEl("1.0.2", "<1.0.1,1.0.2", ",") == true
* matchEl("1.0.2", "<1.0.2", ";") == false * matchEl("1.0.2", "<1.0.2", ";") == false
* matchEl("1.0.2", "1.0.0-1.1.1", ",") == true * matchEl("1.0.2", "1.0.0-1.1.1", ",") == true
* matchEl("1.0.2", "1.0.1,1.0.2-1.1.1", ",") == true * matchEl("1.0.2", "1.0.1,1.0.2-1.1.1", ",") == true
* </pre> * }</pre>
* *
* @param currentVersion 当前本本 * @param currentVersion 当前本本
* @param versionEl 版本表达式可以匹配多个条件使用指定的分隔符默认;分隔, * @param versionEl 版本表达式可以匹配多个条件使用指定的分隔符默认;分隔,