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

commonMain.neat.RequiredValidatorBuilders.kt Maven / Gradle / Ivy

package neat

import neat.internal.RequiredValidator
import kotlin.reflect.KProperty0

fun  Validators.required(
    message: String = "$label is required, but was null"
): Validator = RequiredValidator(this, message)

fun  PropertyValidators.required(
    message: String = "$label is required, but was null"
): Validator {
    parent.properties.add(this)
    return RequiredValidator(this, message)
}

val  KProperty0.required get() = get() ?: throw IllegalArgumentException("$name is required but was null")




© 2015 - 2024 Weber Informatics LLC | Privacy Policy