Skip to content

Commit 7fc57a0

Browse files
committed
Enhance SchemaVersion with detailed Javadoc comments for constructors and methods
1 parent 9c8b22d commit 7fc57a0

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

HMCLCore/src/main/java/org/jackhuang/hmcl/util/gson/SchemaVersion.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,18 @@
4747
@NotNullByDefault
4848
public 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

0 commit comments

Comments
 (0)