Record Class SemVer
java.lang.Object
java.lang.Record
io.github.chrimle.classforge.semver.SemVer
- Record Components:
major- version.minor- version.patch- version.
Represents a Semantic Version (SemVer).
- Since:
- 0.3.0
- Author:
- Chrimle
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Creates a newSemVerwith themajor-version incremented.Creates a newSemVerwith theminor-version incremented.Creates a newSemVerwith thepatch-version incremented.incrementVersion(SemVer.Change change) Creates a newSemVerwith the corresponding version incremented.intmajor()Returns the value of themajorrecord component.intminor()Returns the value of theminorrecord component.intpatch()Returns the value of thepatchrecord component.toString()
-
Constructor Details
-
SemVer
public SemVer(int major, int minor, int patch) Constructs a validSemVerinstance.- Parameters:
major- version.minor- version.patch- version.- Throws:
IllegalArgumentException- ifmajor,minororpatchis less than0.- Since:
- 0.3.0
-
-
Method Details
-
incrementVersion
Creates a newSemVerwith the corresponding version incremented.- Parameters:
change- for determining the newSemVer.- Returns:
- the new
SemVer. - Throws:
IllegalArgumentException- ifchangeisnull.- Since:
- 0.3.0
-
incrementMajor
Creates a newSemVerwith themajor-version incremented.- Returns:
- the new
SemVer. - Since:
- 0.3.0
-
incrementMinor
Creates a newSemVerwith theminor-version incremented.- Returns:
- the new
SemVer. - Since:
- 0.3.0
-
incrementPatch
Creates a newSemVerwith thepatch-version incremented.- Returns:
- the new
SemVer. - Since:
- 0.3.0
-
toString
-
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. All components in this record class 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
-
patch
public int patch()Returns the value of thepatchrecord component.- Returns:
- the value of the
patchrecord component
-