Record Class SemverVersion
java.lang.Object
java.lang.Record
org.openhab.core.thing.firmware.types.SemverVersion
- Record Components:
major- major version numberminor- minor version numberpatch- patch version number
This class represents a semantic version (semver) with major, minor, and patch components.
See Semantic Versioning 2.0 for more details.
- Author:
- Florian Hotze - Initial contribution
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSemverVersion(int major, int minor, int patch) Creates an instance of aSemverVersionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.static SemverVersionfromString(String version) Creates a SemverVersion from a valid semver string, i.e.final inthashCode()Returns a hash code value for this object.booleanisEqualTo(SemverVersion other) Checks if this semver version is equal to the other semver version.booleanisGreaterThan(SemverVersion other) Checks if this semver version is greater than the other semver version.booleanChecks if this semver version is greater than or equal to the other semver version.booleanisLessThan(SemverVersion other) Checks if this semver version is less than the other semver version.booleanisLessThanOrEqualTo(SemverVersion other) Checks if this semver version is less than or equal to the other semver version.intmajor()Returns the value of themajorrecord component.intminor()Returns the value of theminorrecord component.intpatch()Returns the value of thepatchrecord component.toString()Returns a string representation of this record class.
-
Field Details
-
ZERO
-
-
Constructor Details
-
Method Details
-
fromString
Creates a SemverVersion from a valid semver string, i.e.major.minor.patch.- Parameters:
version- the semver string to parse- Returns:
- a SemverVersion
-
isGreaterThan
Checks if this semver version is greater than the other semver version.- Parameters:
other- the other semver version to compare with- Returns:
- true if this version is greater than the other, false otherwise
-
isGreaterThanOrEqualTo
Checks if this semver version is greater than or equal to the other semver version.- Parameters:
other- the other semver version to compare with- Returns:
- true if this version is greater than or equal to the other, false otherwise
-
isLessThan
Checks if this semver version is less than the other semver version.- Parameters:
other- the other semver version to compare with- Returns:
- true if this version is less than the other, false otherwise
-
isLessThanOrEqualTo
Checks if this semver version is less than or equal to the other semver version.- Parameters:
other- the other semver version to compare with- Returns:
- true if this version is less than or equal to the other, false otherwise
-
isEqualTo
Checks if this semver version is equal to the other semver version.- Parameters:
other- the other semver version to compare with- Returns:
- true if both versions are equal, false otherwise
-
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. 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
-