I am working on a project that call a Rest Api which returns JSON, Objects have following structure Api response for each object return only these fields
class A{id, name}
class B{id, name}
class C{id, name}
However, to call Object B, we need to send A.id So I have two approach in my mind to implement
1) add field in class A for class B, and in class B field for class C and so on like class A{id, name, objecB}
2) Or Use Map<A.id, objectB>
and similarly for Map<B.id, objectC>
and so on
As My Project contains many similar classes, what approach will be better to use, I am working in Java.
Aucun commentaire:
Enregistrer un commentaire