Reputation: 11
In Dozer the mapping between domain and DTO classes is done as following:
<mapping>
<class-a>Domain.A</class-a>
<class-b>DTO.A</class-b>
<field>
<a>cField</a>
<b>cField</b>
<a-hint>Domain.Ab</a-hint>
<b-hint>DTO.Ab</b-hint>
</field>
</mapping>
hint is used to let dozer know what type of objects you want created in the destination List(Correct me if I'm wrong). How can we achieve the same in MapStruct?
Where, the implementation of class A is as following:
public class A<T extends Ab> extends B<T>{
}
Implementation of B is as following:
public class B<T extends C> implements serializable{
private List<T> cField = new ArrayList<T>();
private String d;
//getters and setters
}
Implementation of Ab is as following:
public abstract class Ab implements C{
}
Here C is an interface with no fields in it.
There are no fields in Ab and is extended by some E and F classes.
Could you please let me know how would the mapper look like for the above scenario ?
Upvotes: 1
Views: 305