commonMain.neat.CompoundValidators.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of neat-validation-jvm Show documentation
Show all versions of neat-validation-jvm Show documentation
A collection library that is built with interoperability in mind
package neat
import kotlin.reflect.KProperty1
open class CompoundValidators(label: String) : Validators
(label) {
internal val properties = mutableListOf>()
fun KProperty1.validator() = PropertyValidators("$label.${this.name}", this@CompoundValidators, null, this)
// fun KProperty1.validator(builder: (String) -> Validators) = builder("$label ${this.name}")
fun KProperty1.validator(
builder: (String) -> Validators
) = PropertyValidators("$label.${this.name}", this@CompoundValidators, builder("$label.${this.name}") as CompoundValidators, this)
}