Mapping generic Objects in Java

Viewed 26

I'm trying to make a "simple" mapper who basically receive an input (XML right now but is not the point) and pretend to map in a destination object.

assuming for example my source represents a list of Person Object, how can i map it in a List ?

imagine something like:

    List<Person> destination = new ArrayList<>();
    myMapper.map(destination , source);

here my question is how can i access the parametrized generic type of my list in order to populate the list with the incoming datas? is not useful to just pass the generic parameter because if the parametrized type has also a list as a field that doesnt work

thank you for any suggestions, ideas, solutions or workaround.

0 Answers
Related