vendredi 22 octobre 2021

DESIGN PATTERNS - Parsing 4 different JSON files

I have a problem that I cannot figure out. I have 4 different JSON files for configurations. Some of these files require extra API calls whereas others don't for instance.

4 files

A B C D

A and B just require.

A.getConfigs()

B.getConfigs()

C however requires

C.getConfigs()

C.getCase()

D requires

D.getConfigs()

D.getHeader()

What kind of pattern/object should I use when I also want to be able to call individual methods for C and D?

I could very easily move the getCase and getHeader logic into the client code but then I realized I need to use this logic in multiple places in the application code. So what can I do now?

Aucun commentaire:

Enregistrer un commentaire