cn.hutool.core.lang.Version Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hutool-all Show documentation
Show all versions of hutool-all Show documentation
Hutool是一个小而全的Java工具类库,通过静态方法封装,降低相关API的学习成本,提高工作效率,使Java拥有函数式语言般的优雅,让Java语言也可以“甜甜的”。
/*
* Copyright (c) 2024. looly([email protected])
* Hutool is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* https://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
package cn.hutool.core.lang;
import cn.hutool.core.comparator.CompareUtil;
import cn.hutool.core.util.CharUtil;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* 字符串版本表示,用于解析版本号的不同部分并比较大小。
* 来自:java.lang.module.ModuleDescriptor.Version
*
* @author Looly
*/
public class Version implements Comparable, Serializable {
private static final long serialVersionUID = 1L;
/**
* 解析版本字符串为Version对象
*
* @param v 版本字符串
* @return The resulting {@code Version}
* @throws IllegalArgumentException 如果 {@code v} 为 {@code null}或 ""或无法解析的字符串,抛出此异常
*/
public static Version of(final String v) {
return new Version(v);
}
private final String version;
private final List
© 2015 - 2024 Weber Informatics LLC | Privacy Policy