Using reified type parameters, one can write an inline function which works with the type parameter through reflection at runtime:
inline fun
If you are using gson library already in the project(for example json parsing). It provides a class for this. com.google.gson.reflect.TypeToken(). So you could use something like,
com.google.gson.reflect.TypeToken()
f(object : TypeToken>() {}.type)