Version

@Serializable
data class Version(val major: Int, val minor: Int, val patch: Int, var flag: ReleaseStatus = ReleaseStatus.Stable, var isDeprecated: Boolean = false, versionQualifier: Int = 0, versionQualifierPadding: Int = 2) : Comparable<Version>

Represents a version number with optional deprecated and release flag information.

This data class represents a semantic version number consisting of major, minor, and patch components. It additionally provides properties for indicating whether the version is deprecated and its release flag (alpha or beta).

Parameters

major

The major version number.

minor

The minor version number.

patch

The patch version number.

flag

The release flag, indicating whether the version is an alpha or beta release (default: None).

isDeprecated

Whether the version is deprecated (default: false).

versionQualifier

The version qualifier for alpha or beta releases (default: 0).

versionQualifierPadding

The padding for the version qualifier (default: 2).

TODO Create an interface called Version that can be used to represent different types of versions, such as date versions and number versions

  • DateVersion : Version Example: DateVersion(2023, 11, 02)

  • NumericVersion : Version Example: NumericVersion(10, 3, 4)

TODO: Create an interface called Version that can be used to represent different types of versions, such as date versions and numeric versions.

Tasks:

  • Create an interface called Version.

  • Create a class called DateVersion that implements the Version interface.

  • Add the following properties to the DateVersion class:

    • year: The year of the version.

    • month: The month of the version.

    • day: The day of the version.

  • Create a class called NumericVersion that implements the Version interface.

  • Add the following properties to the NumericVersion class:

    • major: The major version number.

    • minor: The minor version number.

    • patch: The patch version number.

  • Update the interface to reference the new DateVersion and NumericVersion classes.

Examples: // Example of a date version val dateVersion = DateVersion(2023, 11, 2) // Example of a number version val numericVersion = NumericVersion(10, 3, 4)

Constructors

Link copied to clipboard
constructor(major: Int, minor: Int, patch: Int, flag: ReleaseStatus = ReleaseStatus.Stable, isDeprecated: Boolean = false, versionQualifier: Int = 0, versionQualifierPadding: Int = 2)

Types

Link copied to clipboard
object Companion
Link copied to clipboard

A builder class for creating Version objects.

Properties

Link copied to clipboard
Link copied to clipboard

Checks if the version is an alpha release.

Link copied to clipboard

Checks if the version is a beta release.

Link copied to clipboard
Link copied to clipboard
val major: Int
Link copied to clipboard
val minor: Int
Link copied to clipboard
val patch: Int

Functions

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

Creates a VersionBuilder object initialized with the current properties of this version object.

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

Converts the version object to a string representation.