-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
First of all: thanks for the great job you are doing with this library, it helps us to save a lot of boilerplate code. I was really happy that you finally released the feature to map maps to beans: https://mapstruct.org/documentation/dev/reference/html/#mapping-map-to-bean
As we use a lot of maps in our project it will be very helpful.
However, I was not really able to make it work in our project so I tried to build a minimal example based on one of your test cases (MapToBeanFromMultipleSource) in the PR. There I noticed that, if the map is a field of a bean the property path in the source parameter is not resolved correctly. Minimized example code:
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import java.util.Map;
@Mapper
public interface MapToBeanFromMultipleSources {
@Mapping(target = "string", source = "bean.strings.string")
Target toTarget(Source bean);
class Source {
private Map<String, String> strings;
public Map<String, String> getStrings() {
return strings;
}
public void setStrings(Map<String, String> strings) {
this.strings = strings;
}
}
class Target {
private String string;
public String getString() {
return string;
}
public void setString(String string) {
this.string = string;
}
}
}
I am receiving: "The type of parameter "bean" has no property named "strings.string". Am I missing something, or is this currently not supported?