✨ New `NotBlankString` type in `org.kotools.types` package
📝 Description
In the org.kotools.types package of the types Gradle subproject, we want to introduce the NotBlankString experimental type for representing a string that has at least one character excluding whitespaces. This type should be available for all Kotlin platforms and Java, but its orNull function shouldn't be accessible from Java, due to its non-explicit support for nullable types.
interface NotBlankString {
val length: PositiveInteger
override fun equals(other: Any?): Boolean
override fun hashCode(): Int
operator fun plus(other: NotBlankString): NotBlankString
operator fun plus(other: String): NotBlankString
override fun toString(): String
companion object {
fun orNull(text: String): NotBlankString? = TODO()
fun orThrow(text: String): NotBlankString = TODO()
}
}
Alongside this type, we want to add the NotBlankString.Companion.stringSerializer() function, in the types-kotlinx-serialization subproject, for serializing the NotBlankString type as String. This function being dedicated to the Kotlin Serialization library, it should be only available for Kotlin.
fun NotBlankString.Companion.stringSerializer(): KSerializer<NotBlankString> = TODO()
🔗 Dependencies
This issue is blocked by the following ones:
- [ ] #661
✅ Checklist
- [ ] ✨ Add the type with a private constructor.
- [ ] ✨ Add the
NotBlankString.Companion.orNull(String)function with tests, documentation and samples. - [ ] ✨ Add the
NotBlankString.Companion.orThrow(String)function with tests, documentation and samples. - [ ] ✨ Add the
NotBlankString.lengthproperty with tests, documentation and samples. - [ ] ✨ Override the
NotBlankString.equals(Any?)function with tests, documentation and samples. - [ ] ✨ Override the
NotBlankString.hashCode()function with tests, documentation and samples. - [ ] ✨ Add the
NotBlankString.plus(NotBlankString)function with tests, documentation and samples. - [ ] ✨ Add the
NotBlankString.plus(String)function with tests, documentation and samples. - [ ] ✨ Add the
NotBlankString.toString()function with tests, documentation and samples. - [ ] ✨ Add the
NotBlankString.Companion.stringSerializer()function with tests, documentation and samples. - [ ] 📝 Update the unreleased changelog for this issue.