Record Class SemVersion
java.lang.Object
java.lang.Record
dev.rono.igniscore.api.SemVersion
- All Implemented Interfaces:
Comparable<SemVersion>
public record SemVersion(int major, int minor, int patch, String preRelease)
extends Record
implements Comparable<SemVersion>
Minimal semver parser used for Ignis extension
api-version checks.
Supports major.minor.patch with an optional -preRelease suffix.-
Constructor Summary
ConstructorsConstructorDescriptionSemVersion(int major, int minor, int patch, String preRelease) Creates an instance of aSemVersionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(SemVersion other) final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanstatic booleanisRuntimeCompatibleWith(SemVersion runtime, SemVersion required) Returns true whenruntimeis the same as or newer thanrequiredon the same major line.intmajor()Returns the value of themajorrecord component.intminor()Returns the value of theminorrecord component.static SemVersionintpatch()Returns the value of thepatchrecord component.Returns the value of thepreReleaserecord component.toString()Returns a string representation of this record class.
-
Constructor Details
-
SemVersion
Creates an instance of aSemVersionrecord class.- Parameters:
major- the value for themajorrecord componentminor- the value for theminorrecord componentpatch- the value for thepatchrecord componentpreRelease- the value for thepreReleaserecord component
-
-
Method Details
-
parse
-
isRuntimeCompatibleWith
Returns true whenruntimeis the same as or newer thanrequiredon the same major line. Pre-release versions are treated as older than the corresponding release. -
isPreRelease
public boolean isPreRelease() -
compareTo
- Specified by:
compareToin interfaceComparable<SemVersion>
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
major
public int major()Returns the value of themajorrecord component.- Returns:
- the value of the
majorrecord component
-
minor
public int minor()Returns the value of theminorrecord component.- Returns:
- the value of the
minorrecord component
-
patch
public int patch()Returns the value of thepatchrecord component.- Returns:
- the value of the
patchrecord component
-
preRelease
Returns the value of thepreReleaserecord component.- Returns:
- the value of the
preReleaserecord component
-