convert

fun <FROM : Any, TO : Any> convert(instance: FROM, to: KClass<TO>): TO(source)

when the types are the same will the conversion be carried out.

Throws

if type 'to' is not assignable from type 'from'