ValueConverter

fun interface ValueConverter<out T>(source)

Custom conversion for a field annotated with @Convert(MyConverter::class). Implement it as an object. Throw IllegalArgumentException for invalid input; the message becomes the error's cause.

object UrlConverter : ValueConverter<Url> {
override fun convert(raw: String): Url = Url(raw)
}

Functions

Link copied to clipboard
abstract fun convert(raw: String): T

Converts the raw text from a source into the field's value.