dimanche 5 juin 2016

Object building in runtime

I have a class with 100 different fields. But all of them aren't mandatory. for example, I need only 5/6 fields to make a valid Json response. I can build a Json string manually or with any library like Gson.

but is there any way to build an object of that class with only mandatory fields? I mean i don't want to go through all 100 fields to find that 5 important fields while using reflection.

Thanks in advance





Aucun commentaire:

Enregistrer un commentaire