<@U092308M7> That could help. But say the ctor is...
# announcements
o
@orangy That could help. But say the ctor is invoked, and the delegate instances have been created. There is still the issue of injecting the proper value from the Json. Say I have any class
T
with a property
var myVar: U by lazy { ... }
During serialization I want to unwrap the value from the Lazy delegate. No problem. I can do this just fine with a
JsonSerializer
. The problem comes when I want to deserialize the Json back into a
T
containing the delegated
U
. I haven't found a way to tell Gson the type of the delegated property in a generic way. When using a
JsonDeserializer
you do get the type of the field being deserialized. Because Gson has that type information. However, in the case of delegated properties, the field in question is referring to a delegate. Not a value. If only there were a way to get a hold of the
KClass
containing the field, I could get the
KProperty
representing the delegated property, and then I could get its type. But it seems that Gson really does not want to give me that option.