hey, I feel super stupid as I fail to formulate a proper search 😄
I need to define a type that takes a generic. The issue is that I do get the target Type as argument (I am creating a retrofit converter but its not a retrofit specific question, just to mention some context).
This is my generic class I want to serialize:
data class Envelope<T> (
val response: T
)
this is the method where i need to instance the generic typed method:
override fun responseBodyConverter(
type: Type,
annotations: Array<Annotation>,
retrofit: Retrofit
): Converter<ResponseBody, *>? {
I cannot find any way to create a parameterized Class with type as
Type
parameter. I'd need something like this:
val response : Envelope<type> = json.decodeFromString(...)