Class Version

java.lang.Object
org.miaixz.bus.core.Version
All Implemented Interfaces:
Serializable, Comparable<Version>

public class Version extends Object implements Comparable<Version>, Serializable
字符串版本表示,用于解析版本号的不同部分并比较大小。 来自:java.lang.module.ModuleDescriptor.Version
Since:
Java 17+
Author:
Kimi Liu
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    版本信息
  • Constructor Summary

    Constructors
    Constructor
    Description
    版本对象,格式:tok+ ( '-' tok+)? ( '+' tok+)?,版本之间使用'.'或'-'分隔,版本号可能包含'+' 数字部分按照大小比较,字符串按照字典顺序比较。 sequence: 主版本号 pre: 次版本号 build: 构建版本
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    all()
    完整版本号
    int
     
    boolean
     
    int
     
    static Version
    解析版本字符串为Version对象
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

    • Version

      public Version(String v)
      版本对象,格式:tok+ ( '-' tok+)? ( '+' tok+)?,版本之间使用'.'或'-'分隔,版本号可能包含'+' 数字部分按照大小比较,字符串按照字典顺序比较。
      1. sequence: 主版本号
      2. pre: 次版本号
      3. build: 构建版本
      Parameters:
      v - 版本字符串
  • Method Details

    • of

      public static Version of(String v)
      解析版本字符串为Version对象
      Parameters:
      v - 版本字符串
      Returns:
      The resulting Version
      Throws:
      IllegalArgumentException - 如果 vnull或 ""或无法解析的字符串,抛出此异常
    • all

      public static String all()
      完整版本号
      Returns:
      the agent
    • compareTo

      public int compareTo(Version that)
      Specified by:
      compareTo in interface Comparable<Version>
    • equals

      public boolean equals(Object ob)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object