Version

value class Version(val raw: String) : Comparable<Version>

A value class representing a semantic version following the pattern "major.minor.patch-suffix".

This class provides functionality to parse version strings and compare versions according to semantic versioning principles. It implements Comparable to support natural ordering of versions.

Examples:

  • "1.0.0" (basic version)

  • "2.1.3" (standard version)

  • "1.0.0-alpha" (version with suffix)

See also

Constructors

Link copied to clipboard
constructor(raw: String)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val major: Int

The major version number.

Link copied to clipboard
val minor: Int

The minor version number.

Link copied to clipboard
val patch: Int

The patch version number.

Link copied to clipboard
val raw: String

The original version string as provided

Functions

Link copied to clipboard
open operator override fun compareTo(other: Version): Int

Compares this version with another version for ordering.

Link copied to clipboard

Checks if this version is compatible with another version.

Link copied to clipboard
open override fun toString(): String

Returns the raw version string.