Package io.camunda.zeebe.util
Record Class SemanticVersion
java.lang.Object
java.lang.Record
io.camunda.zeebe.util.SemanticVersion
- All Implemented Interfaces:
Comparable<SemanticVersion>
public record SemanticVersion(int major, int minor, int patch, String preRelease, String buildMetadata)
extends Record
implements Comparable<SemanticVersion>
A semantic version as specified by Semantic Versioning 2.0.0.
Note that the implementation of Comparable is not consistent with Object.equals(Object) because SemVer does not consider build metadata when comparing versions.
-
Constructor Summary
ConstructorsConstructorDescriptionSemanticVersion(int major, int minor, int patch, String preRelease, String buildMetadata) Creates an instance of aSemanticVersionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thebuildMetadatarecord component.intcompareTo(SemanticVersion other) final 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.intminor()Returns the value of theminorrecord component.static Optional<SemanticVersion> intpatch()Returns the value of thepatchrecord component.Returns the value of thepreReleaserecord component.toString()Returns a string representation of this record class.
-
Constructor Details
-
SemanticVersion
Creates an instance of aSemanticVersionrecord class.- Parameters:
major- the value for themajorrecord componentminor- the value for theminorrecord componentpatch- the value for thepatchrecord componentpreRelease- the value for thepreReleaserecord componentbuildMetadata- the value for thebuildMetadatarecord component
-
-
Method Details
-
parse
-
compareTo
- Specified by:
compareToin interfaceComparable<SemanticVersion>
-
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
-
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
-
buildMetadata
Returns the value of thebuildMetadatarecord component.- Returns:
- the value of the
buildMetadatarecord component
-