Reputation: 351
Using the example bellow:
public void reload(WorkTemplateDTO workTarget) throws Exception {
WorkTemplateDTO work = this.load(data.getId());
workTarget= mapper.map(work, WorkTemplateDTO.class);
}
The instance 'workTarget' received as argument and destination of the copy is being replaced by a new instance with data from 'work'.
I would like to know if is possible to use Dozer to just copy data from source (work) to destination (workTarget) without destroing the old instance of 'workTarget'.
Tks!
Upvotes: 0
Views: 119
Reputation: 124
Dozer also allows object to object mapping, so you can use the mapper in following way
public void reload(WorkTemplateDTO workTarget) throws Exception {
WorkTemplateDTO work = this.load(data.getId());
mapper.map(work, workTarget);
}
ref: DozerBeanMapper
Upvotes: 1