Version

class Version : Comparable<Version>

This class describes a semantic version and related operations.

Constructors

Link copied to clipboard
fun Version(major: Int, minor: Int, patch: Int, preRelease: String? = null, buildMetadata: String? = null)

Constructs a semantic version from the given arguments following the pattern: <major>.<minor>.<patch>-<preRelease>+<buildMetadata>

Types

Link copied to clipboard
object Companion

Companion object of Version.

Functions

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

Component function that returns the MAJOR number of the version upon destructuring.

Link copied to clipboard
operator fun component2(): Int

Component function that returns the MINOR number of the version upon destructuring.

Link copied to clipboard
operator fun component3(): Int

Component function that returns the PATCH number of the version upon destructuring.

Link copied to clipboard
operator fun component4(): String?

Component function that returns the PRE-RELEASE part of the version upon destructuring.

Link copied to clipboard
operator fun component5(): String?

Component function that returns the BUILD-METADATA part of the version upon destructuring.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun toString(): String

Properties

Link copied to clipboard
val buildMetadata: String? = null

The BUILD-METADATA part of the version.

Link copied to clipboard
val isPreRelease: Boolean

Returns true when the version is a pre-release version.

Link copied to clipboard
val major: Int

The MAJOR number of the version.

Link copied to clipboard
val minor: Int

The MINOR number of the version.

Link copied to clipboard
val patch: Int

The PATCH number of the version.

Link copied to clipboard
val preRelease: String?

The PRE-RELEASE part of the version.

Extensions

Link copied to clipboard
fun Version.copy(major: Int = this.major, minor: Int = this.minor, patch: Int = this.patch, preRelease: String? = this.preRelease, buildMetadata: String? = this.buildMetadata): Version

Constructs a copy of the Version. The copied object's properties can be altered with the optional parameters.

Link copied to clipboard
fun Version.nextMajor(): Version

Increments the version by its MAJOR number. Returns a new version while the original remains unchanged.

Link copied to clipboard
fun Version.nextMinor(): Version

Increments the version by its MINOR number. Returns a new version while the original remains unchanged.

Link copied to clipboard
fun Version.nextPatch(): Version

Increments the version by its PATCH number. Returns a new version while the original remains unchanged.

Link copied to clipboard
fun Version.nextPreRelease(): Version

Increments the version by its PRE-RELEASE part. Returns a new version while the original remains unchanged.

Sources

Link copied to clipboard