I have a method in a service that updates an entity. It accepts object that has the data to update the entity. Dto object has less fields than entity but the fields have the same names.
Could it be possible to use mapstruct for that routine job by passing an existing target object?
class Entity {
id
name
date
country
by
... //hell of the fields
}
class UpdateEntity {
name
country
... //less but still a lot
}
class EntityService {
update(UpdateEntity u) {
Entity e = // get from storage
mapstructMapper.mapFromTo(u, e)
}
}