我试图将两个字段映射到单个对象,其中相关字段是列表对象,并且所述对象不能更改。
@Mapping(target = "myWrapperObject.myListObject",
expression = "java(myListMap.get(keyParent.getKey()))")
@Mapping(target = "myOtherObject", expression = "java(myOtherClassList.add(myOtherObject))")
MyFinalClass mapStuff(Map<String, List<MyClass>> myListMap, MyOtherClass keyParent);
如果我尝试这样做并进行构建,我会得到类似
[ERROR]/path/to/my/mapperImpl.java: cannot find symbol
[ERROR] symbol: variable myListMap
[ERROR]/path/to/my/mapperImpl.java: cannot find symbol
[ERROR] symbol: variable keyParent
这没有意义,因为这两个符号都在参数中传递,我认为它们会被识别。我在这里想念什么?