Date post: | 08-Jul-2015 |
Category: |
Software |
Upload: | anton-derevyanko |
View: | 33 times |
Download: | 0 times |
Deserialise dynamic entities with GSON
Jedi-way
Anton Derevyanko
The problem
Android + Gson + backend with dynamic entities
Dynamic entity?
Sith-way
Parse it manually!
Jedi-way
Create
parent class + type-specific children
Implement JsonDeserializer<T>
Parent class and childrenBase class:
Child class:
Write custom deserialiser:
Use it: