jeudi 7 juin 2018

Jackson/Reflection change Bean fields order dynamically

I've a Bean which has months Jan - Dec & some other fields.

Jackson always writing the json result in a same order as mentioned in the Bean class, but i want to change field ordering dynamically.

For Ex : Let's say i always want the data of recent 12 months i.e July-2017 to June-2018...next month i may need Aug-2017 to July-2018 & so on..

I'm not getting this result until i change the order of fields manually in Bean class.

or just wonder whether is there any way to change the field order dynamically using Reflection?





Aucun commentaire:

Enregistrer un commentaire