Top Banner
Deserialise dynamic entities with GSON Jedi-way Anton Derevyanko
8

Method for parsing dynamic entities for Android development

Jul 08, 2015

Download

Software

Method for parsing dynamic entities for Android development (using Gson)
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Method for parsing dynamic entities for Android development

Deserialise dynamic entities with GSON

Jedi-way

Anton Derevyanko

Page 2: Method for parsing dynamic entities for Android development

The problem

Android + Gson + backend with dynamic entities

Dynamic entity?

Page 3: Method for parsing dynamic entities for Android development

Sith-way

Parse it manually!

Page 4: Method for parsing dynamic entities for Android development

Jedi-way

Create

parent class + type-specific children

Implement JsonDeserializer<T>

Page 5: Method for parsing dynamic entities for Android development

Parent class and childrenBase class:

Child class:

Page 6: Method for parsing dynamic entities for Android development

Write custom deserialiser:

Page 7: Method for parsing dynamic entities for Android development

Use it:

Page 8: Method for parsing dynamic entities for Android development

Thank you for your attention

Questions? Find me:

skype: derevyanko.anton mail: [email protected]