-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Labels
commonItem related to all platforms.Item related to all platforms.featureNew feature or request.New feature or request.
Description
π Description
For representing an integer of type Int
that is less than zero, we want to add the NegativeInt
experimental type, in the org.kotools.types
package of the types
Gradle subproject.
By default, this type should be serializable as Int
.
Here's the minimum viable Application Programming Interface (API) for the NegativeInt
type:
// In 'org.kotools.types' package:
class NegativeInt private constructor(private val number: Int) {
override fun equals(other: Any?): Boolean = TODO()
override fun hashCode(): Int = TODO()
fun toInt(): Int = TODO()
override fun toString(): String = TODO()
companion object {
fun orNull(number: Int): NegativeInt? = TODO()
fun orThrow(number: Int): NegativeInt = TODO()
}
}
// In 'org.kotools.types.kotlinx.serialization' package:
fun NegativeInt.Companion.intSerializer(): KSerializer<NegativeInt> = TODO()
β Checklist
- β¨ Add the type with its private constructor, its
Companion.orNull(Int)
andtoInt()
methods with tests, documentation and samples. - β¨ Add the
NegativeInt.Companion.orThrow(Int)
method with tests, documentation and samples. - β¨ Override the
NegativeInt.toString()
method with tests, documentation and samples. - β¨ Override the structural equality operations (
equals(Any?)
andhashCode()
methods) of theNegativeInt
type with tests, documentation and samples. - β¨ Add the
NegativeInt.Companion.intSerializer()
function with tests, documentation and samples. - β¨ Update the
KotoolsTypesSerializersModule()
function for making theNegativeInt
type serializable asInt
by default. - π Update the unreleased changelog for this issue.
- π Create an issue for stabilizing this type.
Metadata
Metadata
Assignees
Labels
commonItem related to all platforms.Item related to all platforms.featureNew feature or request.New feature or request.