mapstruct-plus
mapstruct-plus copied to clipboard
不同属性名不同类型映射问题
@Data
@Schema(description = "个人路由VO")
@AutoMapper(target = Resource.class, uses = RouteVO.class, convertGenerate = false)
public class RouteVO {
@Schema(description = "键值")
private String key;
@Schema(description = "名称")
private String name;
@AutoMappings({
@AutoMapping(source = "meta.title", target = "title"),
@AutoMapping(source = "meta.icon", target = "icon"),
@AutoMapping(source = "meta.nav", target = "type", qualifiedByName = "type2Nav")
})
@Schema(description = "元数据")
private Meta meta;
@Data
@Schema(description = "元数据")
public static class Meta {
@Schema(description = "标题")
private String title;
@Schema(description = "图标")
private String icon;
@Schema(description = "是否导航")
private Boolean nav;
}
@Named("RouteVOType2Nav")
public Boolean type2Nav(ResTypeEnum type) {
return ResTypeEnum.NAV.equals(type);
}
}
编译打包时报错Can't map property "ResTypeEnum source.type" to "Boolean meta.nav". Consider to declare/implement a mapping method: "Boolean map(ResTypeEnum value)".
是我用法有误吗?