Package dev.architectury.loom.util
Record Class Version
java.lang.Object
java.lang.Record
dev.architectury.loom.util.Version
- All Implemented Interfaces:
Comparable<Version>
public record Version(int major, int minor, int micro, int patch, @Nullable String qualifier)
extends Record
implements Comparable<Version>
A simple version class that can be used to compare versions.
This class allows for versions that are not strictly following the semver specification,
but are still allowed in the context of gradle versioning.
This class is intentionally very flexible and does not enforce any specific versioning scheme, and should be very similar to the versioning used by gradle itself.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intmajor()Returns the value of themajorrecord component.intmicro()Returns the value of themicrorecord component.intminor()Returns the value of theminorrecord component.static Versionstatic Versionintpatch()Returns the value of thepatchrecord component.@Nullable StringReturns the value of thequalifierrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
UNKNOWN
-
-
Constructor Details
-
Version
Creates an instance of aVersionrecord class.- Parameters:
major- the value for themajorrecord componentminor- the value for theminorrecord componentmicro- the value for themicrorecord componentpatch- the value for thepatchrecord componentqualifier- the value for thequalifierrecord component
-
-
Method Details
-
parse
-
parse
-
asBaseVersion
-
compareTo
- Specified by:
compareToin interfaceComparable<Version>
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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 '=='. -
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
-
micro
public int micro()Returns the value of themicrorecord component.- Returns:
- the value of the
microrecord component
-
patch
public int patch()Returns the value of thepatchrecord component.- Returns:
- the value of the
patchrecord component
-
qualifier
Returns the value of thequalifierrecord component.- Returns:
- the value of the
qualifierrecord component
-