I have a line of code where I am converting my Object
to POJO. I am using jackson library for this.
POJO container = objectMapper.convertValue(resource, POJO.class);
Now I have to do this for many (~50) POJOs. So instead of writing so many switch cases, I wanted to do it in one line dynamically. I have a enum from where I will get my POJO name.
Is there a easy way to achieve this. I searched and got an idea that Class.forName
shall be used. I will get POJO.class from there. How to get reference to POJO dynamically?
Aucun commentaire:
Enregistrer un commentaire