When declaring a mapper like so using MapStruct version 1.1.0.CR2:
Mapper:
@Mapper(uses = {personMapper.class})
public interface CarMapper {
SuperCar mapCar(Car source, @MappingTarget SuperCar destination);
}
Custom Mapper
@Component
public class EslUserCustomFieldMapMergeMapper {
public Map<String,Person> merge(Map<String,Person> source, @MappingTarget Map<String,Person> destination){
source.entrySet().forEach(entry -> destination.put(entry.getKey(), entry.getValue()));
return destination;
}
}
Car containing a Map of Person
public class Car {
private Map<String, Person> persons = new HashMap<String, Person>();
...
}
The generate code is missing import for type Person. The generate code (CarMapperImpl.java) contains the following and is missing import for the type Person, thus it doesn't compile:
...
if ( destination.getPersons() == null ) {
destination.setPersons( new HashMap<String, Person>() );
}
carMapper.merge( source.getPersons(), destination.getPersons() );
...
Is it possible to add a hint or something so that the generator knows to add the import for the type Person?
When declaring a mapper like so using MapStruct version 1.1.0.CR2:
Mapper:
Custom Mapper
Car containing a Map of Person
The generate code is missing import for type
Person. The generate code (CarMapperImpl.java) contains the following and is missing import for the typePerson, thus it doesn't compile:Is it possible to add a hint or something so that the generator knows to add the import for the type
Person?