File tree Expand file tree Collapse file tree
HMCLCore/src/main/java/org/jackhuang/hmcl/util/gson Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4747@ NotNullByDefault
4848public record SchemaVersion (int major , int minor ) implements Comparable <SchemaVersion > {
4949
50+ /// @param major the major schema version
51+ /// @param minor the minor schema version
5052 public SchemaVersion {
5153 if (major < 0 ) throw new IllegalArgumentException ("Major version must be non-negative: " + major );
5254 if (minor < 0 ) throw new IllegalArgumentException ("Minor version must be non-negative: " + minor );
5355 }
5456
57+ /// Parses a schema version string.
58+ ///
59+ /// @param version the version string, either `major` or `major.minor`
60+ /// @return the parsed schema version
61+ /// @throws IllegalArgumentException if the version string is invalid
5562 public static SchemaVersion parse (String version ) {
5663 int dot = version .indexOf ('.' );
5764
@@ -66,6 +73,11 @@ public static SchemaVersion parse(String version) {
6673 }
6774 }
6875
76+ /// Compares this version with another schema version.
77+ ///
78+ /// @param o the other version to compare to
79+ /// @return a negative integer, zero, or a positive integer as this version
80+ /// is less than, equal to, or greater than the specified version
6981 @ Override
7082 public int compareTo (SchemaVersion o ) {
7183 return major != o .major
You can’t perform that action at this time.
0 commit comments