I have two classes and want to map the properties from Female object to Male object using org.dozer.Mapper(http://dozer.sourceforge.net/).
The first class is:
public class Male {
private String name;
private String surname;
private Map<String, List<Contact>> contacts;
....
and the second class is :
public class Female {
private String name;
private String surname;
private String mobile;
private String dateOfBirth;
private Map<String, List<Contact>> contacts;
...
and the third class is :
public class Contact {
private String street;
private String postcode;
private String email;
...
The Map that i am using like object property is LinkedHashMap and the List which is a value in the Map is ArrayList. When I try to map them using the dozer, the array list which is the value in the hash map is not a list with objects and looks like in the picture:
Map<String, List<Contact>> contact = new LinkedHashMap<>();
List<Contact> listOfContacts = new ArrayList<>();
Contact contactObj = new Contact();
contactObj.setEmail("lala@gmail.com");
contactObj.setPostcode("1233355");
contactObj.setStreet("street");
listOfContacts.add(contactObj);
contact.put("2131323213", listOfContacts);
femaleObj.setContact(contact);
Mapper objectMapper = new DozerBeanMapper();
Male maleObj = objectMapper.map(femaleObj, Male.class);
How can I get the list of objects in the List in the Male object?