Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/facebook/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mapping 带有XSI类型映射的MapStruct_Mapping_Mapstruct_Xsitype - Fatal编程技术网

Mapping 带有XSI类型映射的MapStruct

Mapping 带有XSI类型映射的MapStruct,mapping,mapstruct,xsitype,Mapping,Mapstruct,Xsitype,我不熟悉映射结构。我正在尝试将JSON转换为XML。我的XML组件正在查找XSI类型。我已经用XSI类型对象的强制转换完成了自定义映射。但是XML缺少XSI类型。在子系统中处于领先地位 default com.test.sales.types.Order map(com.test.order.types.Order value) { if (value != null) { com.test.sales.types.Order mapping = null;

我不熟悉映射结构。我正在尝试将JSON转换为XML。我的XML组件正在查找XSI类型。我已经用XSI类型对象的强制转换完成了自定义映射。但是XML缺少XSI类型。在子系统中处于领先地位

default com.test.sales.types.Order map(com.test.order.types.Order value) {
    if (value != null) {
        com.test.sales.types.Order mapping = null;
        if (value instanceof com.test.order.types.X)
            mapping = map((com.test.order.types.X) value);
        else if (value instanceof com.test.order.types.Y)
            mapping = map((com.test.order.types.Y) value);
        return mapping;
    }
    return null;
};

如果在根元素对象上设置对象,则工作正常

default com.test.sales.types.X mapX(com.test.order.types.Order value) {
    com.test.sales.types.Order mapping = 
        mapping = map((com.test.order.types.X) value);
    return mapping;
})

})

}否则{

returns.setOrder(mapY(data.getOrder()));
}
}

缺少XSI类型是什么意思?MapStruct映射到对象而不是XML。你能给我们展示一个更好的例子,用错误的实际代码吗。。。。
default com.test.sales.types.Sales map(com.test.order.types.Sales data) {
com.test.sales.types.Sales returns = new com.test.sales.types.Sales();


if (data.getOrder().getIsXObj()) {
returns.setOrder(mapX(data.getOrder()));
returns.setOrder(mapY(data.getOrder()));