mardi 16 octobre 2018

Transform an object to a Dictionary of [String: Any] best design pattern?

I need to create a Dictionary [String: Any] Y from an Object X. Not all the fields in the Object are needed. What kind of design pattern can I apply here?

The Dictionary Y will have keys as String that are hard coded and the values will be of Any type and associated to a few of the field values of the Object X.

I was thinking something like a Transformer but can't find enough material online to try it out.

Aucun commentaire:

Enregistrer un commentaire