commonMain.ru.astrainteractive.klibs.mikro.validation.ValidationContext.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mikro-validation Show documentation
Show all versions of mikro-validation Show documentation
Kotlin Multiplatform library with useful code
The newest version!
package ru.astrainteractive.klibs.mikro.validation
/**
* Context of current validation scope
*
* [T] - validatable value type
*
* [R] - result, which will be returned when validation pass failed
*/
interface ValidationContext {
/**
* Validatable value
*/
val value: T
/**
* Remember validation for current value
*/
fun validate(otherwise: R, validation: Validation): Validation
/**
* Remember validation for current value
*/
fun validate(otherwise: (T) -> R, validation: Validation): Validation
/**
* Create list of remembered validators
*/
fun create(): List>
}