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

commonMain.io.github.lyxnx.util.validation.Validator.kt Maven / Gradle / Ivy

There is a newer version: 1.6.1
Show newest version
package io.github.lyxnx.util.validation

/**
 * A validator that takes [T] as the input to validate, and returns [R] as its validation result
 *
 * @param T the input to validate
 * @param R the result from validating
 */
public fun interface TypeValidator {
    /**
     * Validates [input], returning [R] as its result
     */
    public fun validate(input: T?): R
}

/**
 * An implementation of a [TypeValidator] that takes a string as its input and returns some result, [R]
 */
public fun interface StringInputValidator : TypeValidator

/**
 * Represents the result of an input validation
 */
public interface ValidationResult {
    /**
     * Whether the result is a valid, successful result
     */
    public val isValid: Boolean
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy