Hi,
I'm starting to learn java and trying to use modelmapper to convert beans to entities and vice versa in a spring mvc project. The classes (without Bean in the name) are hibernate entities f.ex. Applicant and I need to convert them to their corresponding bean (f.ex. ApplicantBean).
f.ex. I have the following classes:
class Country { some stuff }
class CountryBean { some stuff }
class Address { Country country }
class AddressBean { int countryId}
class Application {
Date applicationDate;
etc
}
class ApplicationBean {
Date applicationDate;
etc
}
class Applicant {
List<Application> applications;
String addressCity;
Country addressCountry;
String lastName;
String firstName;
etc
}
class ApplicantBean {
List<ApplicationBean> applications;
AddressBean address;
String lastName;
String firstName;
etc
}
I have to admit that I have problems to fully understand the modelmapper documentation.
How would you convert the entity class Applicant to an ApplicantBean with ModelMapper (and vice-versa)?
There are a lot of embedded Objects and List<T> Objects etc ... so I'm kind of stuck ...
Thank you very much for helping!
Kind regards,
Didier