I have a situation, where I need to map multi objects (in a flat structure) into one object (an hierarchy object) in Java using ModelMapper.
For example,
class Person{
String name;
int age;
}
class Address{
int streetSumber;
String streetName;
String city;
}
class Phone{
String type;
String number;
}
What I want to get out from the model mapper is something like
class PersonDTO{
String name;
int age;
class AddressDTO{
int streetSumber;
String streetName;
String city;
}
class PhoneDTO{
String type;
String number;
}
}
Is there a way to simple achieve this?
Thanks