If I have the following classes;
class Customer{
private String name;
private Address address;
List<Auto> autos;
// getters and setters
}
class Address {
private String street;
private String city;
private String zip;
// getters and setters
}
class Auto {
private String model;
private String make;
// getters and setters
}
And I mapping into the following classes (they are purposely identical except for classname to isolate the problem I am having)
class CustomerDTO {
private String name;
private AddressDTO addressDTO;
List<AutoDTO> autoDTOs;
// getters and setters
}
class AddressDTO {
private String street;
private String city;
private String zip;
// getters and setters
}
class AutoDTO {
private String model;
private String make;
// getters and setters
}
How would I go about configuring ModelMapper to handle the child objects with classnames that only differ by a suffix of DTO. I am currently using the following configuration options, which will map all of the fields in Customer, but Address and List<Auto> arrive null every time.
modelMapper.getConfiguration().setSourceNameTokenizer(NameTokenizers.UNDERSCORE)
.setDestinationNameTokenizer(NameTokenizers.CAMEL_CASE)
.setFieldMatchingEnabled(true)
Thanks!
Hazer