commonMain.io.mths.kava.ValidationScope.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kava-common-jvm Show documentation
Show all versions of kava-common-jvm Show documentation
Common interfaces shared by the other kava modules.
The newest version!
package io.mths.kava
/**
* Provides a scope to deal with validation logic.
* Everytime a possible invalid value like an empty Optional or null is accessed,
* the scope immediately skips the remaining code inside and returns an invalid result.
*/
interface ValidationScope {
/**
* This method stops execution of the current [ValidationScope].
*
* The Scope returns an invalid result ( like null or an empty [java.util.Optional] ).
*
* */
fun fail(): Nothing
/**
* Runs [block] in the current scope and uses validator
* to return a wrapped result.
*/
fun host(
validator: Validator,
block: ValidationScope.() -> ScopeType
): WrapperType
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy