I used the following link to get around the limitations arising from type erasure in Java.
kotlin reified generic in virtual function
I want the following class to be interfaced as follows:
class KlaxonJsonParserAdapter(private val klaxon: Klaxon) : JsonParser {
override fun <T: Any> parse(string: String, type: KClass<T>): T = klaxon.parse<type>(string)
}
Subsequently, it enables to use it as such:
JsonParser.parse<Type>(string: String)
through extension functions.
But I couldn't figure out how to use the type parameter to external dependency as a reified type to achieve what I want.
I cannot plug the variable into the template slot as such:
klaxon.parse<type>(string)