I am a novice to Dozer
and I just learnt to map one source object to destination using Dozer. I have to convert the source to destinations based on condition. But how can I map one field from source as another field into multiple destinations?
is this something possible at all in Dozer
?(if not Dozer
, anything else support this)
source class
class Employee{
@Mapping("cId") //==> this works only for Contractor mapping
private Integer eId;
@Mapping("managerName") //==> this works only for Manager mapping
private String eName;
private boolean isManager;
// set&get methods
}
destination1 class
class Contractor{
private Integer cId;
private String cName;
// set&get methods
}
destination2 class
class Manager{
private Integer managerId;
private String managerName;
// set&get methods
}
mapping
Contractor contractor = new DozerBeanMapper().map(employee, Contractor.class);
Manager manager = new DozerBeanMapper().map(employee, Manager.class);