4 ms·
Last week wanted to use GSON in a generic method to deserialize to a type which is generic type parameter, in a method of the abstract base class. Unfortunately
by kodfodrasz 10y ago
Last week wanted to use GSON in a generic method to deserialize to a type which is generic type parameter, in a method of the abstract base class. Unfortunately it could not be done without the implementations passing up their .class via super constructor.
IMHO deserializing JSON is quite a common application code.
If you are really interrested I'd create example code, but (as being lazy, and the mentioned code not being my property) I'd hope to take my word for granted :)
edit: I wrote useless in many cases!
- deleted 10y ago[deleted]
- slantedview 10y agoThere are ways to resolve generics declared on base classes: https://github.com/jhalterman/typetools https://github.com/jhalterman/typetools ...but proper support of reified generics certainly would have been better.