Semver

class Semver @JvmOverloads() constructor(originalValue: String, type: Semver.SemverType) : Comparable<Semver>

Semver is a tool that provides useful methods to manipulate versions that follow the "semantic versioning" specification (see http://semver.org)

Constructors

Semver
Link copied to clipboard
fun Semver(originalValue: String, type: Semver.SemverType = SemverType.STRICT)

Types

Companion
Link copied to clipboard
object Companion
SemverType
Link copied to clipboard
enum SemverType : Enum<Semver.SemverType>
The different types of supported version systems.
VersionDiff
Link copied to clipboard
enum VersionDiff : Enum<Semver.VersionDiff>
The types of diffs between two versions.

Functions

compareTo
Link copied to clipboard
open operator override fun compareTo(version: Semver): Int
diff
Link copied to clipboard
fun diff(version: Semver): Semver.VersionDiff
Returns the greatest difference between 2 versions.
fun diff(version: String): Semver.VersionDiff
equals
Link copied to clipboard
open operator override fun equals(o: Any?): Boolean
hashCode
Link copied to clipboard
open override fun hashCode(): Int
isEqualTo
Link copied to clipboard
fun isEqualTo(version: Semver): Boolean
Checks if the version equals another version
fun isEqualTo(version: String): Boolean
isEquivalentTo
Link copied to clipboard
fun isEquivalentTo(version: Semver): Boolean
Checks if the version equals another version, without taking the build into account.
fun isEquivalentTo(version: String): Boolean
isGreaterThan
Link copied to clipboard
fun isGreaterThan(version: Semver): Boolean
Checks if the version is greater than another version
fun isGreaterThan(version: String): Boolean
isGreaterThanOrEqualTo
Link copied to clipboard
fun isGreaterThanOrEqualTo(version: Semver): Boolean
Checks if the version is greater than or equal to another version
fun isGreaterThanOrEqualTo(version: String): Boolean
isLowerThan
Link copied to clipboard
fun isLowerThan(version: Semver): Boolean
Checks if the version is lower than another version
fun isLowerThan(version: String): Boolean
isLowerThanOrEqualTo
Link copied to clipboard
fun isLowerThanOrEqualTo(version: Semver): Boolean
Checks if the version is lower than or equal to another version
fun isLowerThanOrEqualTo(version: String): Boolean
nextMajor
Link copied to clipboard
fun nextMajor(): Semver
nextMinor
Link copied to clipboard
fun nextMinor(): Semver
nextPatch
Link copied to clipboard
fun nextPatch(): Semver
satisfies
Link copied to clipboard
fun satisfies(requirement: Requirement): Boolean
Check if the version satisfies a requirement
fun satisfies(requirement: String): Boolean
Check if the version satisfies a requirement
toStrict
Link copied to clipboard
fun toStrict(): Semver
toString
Link copied to clipboard
open override fun toString(): String
withBuild
Link copied to clipboard
fun withBuild(build: String?): Semver
withClearedBuild
Link copied to clipboard
fun withClearedBuild(): Semver
withClearedSuffix
Link copied to clipboard
fun withClearedSuffix(): Semver
withClearedSuffixAndBuild
Link copied to clipboard
fun withClearedSuffixAndBuild(): Semver
withIncMajor
Link copied to clipboard
fun withIncMajor(increment: Int = 1): Semver
withIncMinor
Link copied to clipboard
fun withIncMinor(increment: Int = 1): Semver
withIncPatch
Link copied to clipboard
fun withIncPatch(increment: Int = 1): Semver
withSuffix
Link copied to clipboard
fun withSuffix(suffix: String): Semver

Properties

build
Link copied to clipboard
val build: String?
Returns the build of the version.
isStable
Link copied to clipboard
val isStable: Boolean
Determines if the current version is stable or not.
major
Link copied to clipboard
var major: Int? = null
Returns the major part of the version.
minor
Link copied to clipboard
var minor: Int? = null
Returns the minor part of the version.
originalValue
Link copied to clipboard
val originalValue: String
patch
Link copied to clipboard
var patch: Int? = null
Returns the patch part of the version.
suffixTokens
Link copied to clipboard
val suffixTokens: Array<String?>?
Returns the suffix of the version.
type
Link copied to clipboard
val type: Semver.SemverType
value
Link copied to clipboard
val value: String
Get the original value as a string