I have a class that has 2 different objects under same class:
public class Customer {
//Source Attr
public Addr addr;
//target
public AddressDTO custAddr;
}
public class Addr {
public String street_Name;
public String home_Num;
public String post_code;
}
public class AddressDTO {
public String streetName;
public String homeNum;
public String postcode;
}
I am trying to map Addr -> AddressDTO object in Customer Object:
ClassMapBuilder<?,?> classMapper = factory.classMap(Customer.class, Customer.class).classMap.field(addr.street_Name, custAddr.streetName).byDefault().register();
Customer source = new Customer();
source.setName("tester");
Addr addr = new Addr("streetname","123","456");
source.setAddr(addr);
Customer target = mapper.map(source,Customer.class);
When I run this, i get this error:
Caused by: java.lang.IllegalArgumentException: java.lang.String is an unsupported source class for constructing instances of com.domain.AddressDTO