java - Mapping nested object with mapstruct -


i create mapping below. how map flat dto object properties (street, city, etc) nested address in domain object. when try i've got error:

[error] diagnostic: unknown property "address.postalcode" in return type. @mapping(source = "city", target = "address.city"),

@mapper(componentmodel = "spring", uses = {}) public interface companymapper {     @mappings({             @mapping(source = "id", target = "id"),             @mapping(source = "street", target = "address.street"),             @mapping(source = "city", target = "address.city"),             @mapping(source = "postalcode", target = "address.postalcode"),             @mapping(source = "province", target = "address.province"),     })     domainobject map(dtoobject dto); 

and classes...

public class address {             private string street;             private integer streetnumber;             private string city;             private string postalcode;             private string province;             //getters , setters     } public class domainobject {         private string id;         private address address;         //getters , setters }  public class dtoobject {         private string id;         private string street;         private string city;         private string postalcode;         private string province;         //getters , setters } 

nesting on target side trying use not supported yet. there's feature request (issue #389), did not yet implementing this.


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -