All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ru.astrainteractive.gradleplugin.property.extension.PrimitivePropertyValueExt.kt Maven / Gradle / Ivy

There is a newer version: 1.4.0
Show newest version
package ru.astrainteractive.gradleplugin.property.extension

import ru.astrainteractive.gradleplugin.property.PropertyValue

object PrimitivePropertyValueExt {
    // String
    val PropertyValue.stringOrNull: String?
        get() = value.getOrNull()
    val PropertyValue.stringOrEmpty: String
        get() = stringOrNull.orEmpty()
    val PropertyValue.requireString: String
        get() = value.getOrThrow()

    // Integer
    val PropertyValue.int: Result
        get() = value.mapCatching { it.toInt() }
    val PropertyValue.intOrNull: Int?
        get() = int.getOrNull()
    val PropertyValue.requireInt: Int
        get() = int.getOrThrow()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy