Goog Day to all: This is my first question and i may have failed to find a similar question, and so im posting this one. I am making an app in android for Guild Wars 2 and I'm new, this is my first project for full implementng an app having all considerations for good practices. As for my problem I am now, modeling the clases for JSON strings responses from GW2 API. Lets Start with "item" API JSON: WIKI: https://wiki.guildwars2.com/wiki/API:2/items EXAMPLE: https://api.guildwars2.com/v2/items/28445
I am modeling the class for GSON deserialization on A CLASS Diagram (not coded yet) and i'm having issues with the "details" object inside the "item" JSON. The "details" object is variable and may or may not have subobjects.
So the issues Are:
- The "details" Subobject changes depending on the id requested.
Q1.1: Should i create a BIG detail Class with all possibilities added and use Gson to leave empty those properties who won't match? or create one class for each different subobjects (in API subobject meaning Armor, Weapon, Trinket, etc).
Q1.2: If I pick the later option how does GSON now what subObject/class to pick?. - If the Subobject(2nd level) Has inner Object(3rd level) these smaller objects are only 2 kinds. Q2.1:should i make subclasses inside each subObject (second level) that has these objects(third level) inside?