since 3 years ago
9 of 9
Tip Reveddit Real-Time can notify you when your content is removed.
your account history
Tip Check if your account has any removed comments.
view my removed comments you are viewing a single comment's thread.
view all comments


I want to be sure to understand how this would work without type erase.
At runtime the method readValue know the type it should return and then it select the deserializer based on it ?
My brain must be formatted by the use of java because this is scarring me.
What happens if there is no deserializer for the type ? Can you check it at compile time or does it explode with an exception ?
I also fail to see the advantage compared to something like :
You still only specify the type one time but in the method instead of the assigned variable. You also have to make specific code to handle the Car type in both case, or is objectMapper.readValue dynamically looking for the parser (with reflexion for example) ?
Sorry if it seems like trolling, but I'm really not understanding why this is such a big advantage.
I feel that I'm missing something fundamental but I'll stop there as I don't see this discussion going forward.
This is a very specialized tool that probably employee reflection. A couple of years ago I built an MTProto (Telegram's protocol) serializer and deserializer using compile time code generation. Modern libraries and frameworks which do this are heading towards this direction.
Did you write it in Java?
Kotlin. I've used a custom parser and KotlinPoet to emit Kotlin classes.