Mapper
A generic interface for mapping an object of type F (from) to an object of type T (to).
This interface uses an operator function invoke, allowing instances to be called like functions.
Example usage:
class StringToIntMapper : Mapper<String, Int> {
override fun invoke(from: String): Int {
return from.toIntOrNull() ?: 0
}
}
val mapper = StringToIntMapper()
val result = mapper("123") // result is 123Content copied to clipboard