predicated

Convenience shortcut for creating a success or error depending on a boolean state.

Used if the value returned will be the same regardless of validation, e.g. in the case of EntryValidator usage, where no changes are being made to the result

Return

the error ValidationResult

Author

fzzyhmstrs

Since

0.7.0

Parameters

T

Type of result

storedVal

default or fallback instance of type T

valid

test applied to determine validation or error.

builder

UnaryOperator<ErrorEntry.Builder> operator for applying content to a provided error builder


fun <T> predicated(storedVal: T, valid: Boolean, error: String): ValidationResult<T>

Deprecated

Plain error strings are deprecated but acceptable. Most of the time passing in ErrorContext is preferred

Convenience shortcut for creating a success or error depending on a boolean state.

Used if the value returned will be the same regardless of validation, e.g. in the case of EntryValidator usage, where no changes are being made to the result

Return

the error ValidationResult

Author

fzzyhmstrs

Since

0.2.0, deprecated 0.7.0

Parameters

T

Type of result

storedVal

default or fallback instance of type T

valid

test applied to determine validation or error.

error

string with error message


fun <T> predicated(storedVal: T, valid: Boolean, error: ValidationResult.ErrorEntry): ValidationResult<T>

Deprecated

Plain error strings are deprecated but acceptable. Most of the time passing in ErrorContext is preferred

Convenience shortcut for creating a success or error depending on a boolean state.

Used if the value returned will be the same regardless of validation, e.g. in the case of EntryValidator usage, where no changes are being made to the result

Return

the error ValidationResult

Author

fzzyhmstrs

Since

0.7.0

Parameters

T

Type of result

storedVal

default or fallback instance of type T

valid

test applied to determine validation or error.

error

ErrorEntry providing information about the possible error


fun <T> predicated(storedVal: T, valid: Boolean, error: Supplier<String>): ValidationResult<T>

Deprecated

Plain error strings are deprecated but acceptable. Most of the time passing in ErrorContext is preferred

Convenience shortcut for creating a success or error depending on a boolean state.

Used if the value returned will be the same regardless of validation, e.g. in the case of EntryValidator usage, where no changes are being made to the result

Return

the error ValidationResult

Author

fzzyhmstrs

Since

0.6.9, deprecated 0.7.0

Parameters

T

Type of result

storedVal

default or fallback instance of type T

valid

test applied to determine validation or error.

error

supplier of strings with an error message