我有一个xml推土机映射的问题,要么它不支持这种深度映射,要么我做错了。 来源是:
Public Class ABean{
private List<AABean> aa;
}
Public Class AABean{
private List<BBean> b;
}
Public Class BBean{
private List<String> c;
}
目的地是:
Public Class A{
private List<AA> aa;
}
Public Class AA{
private List<B> b;
}
Public Class B{
private List<String> c;
}
映射是:
<mappings xmlns="http://dozer.sourceforge.net"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://dozer.sourceforge.net
http://dozer.sourceforge.net/schema/beanmapping.xsd">
<mapping type="one-way" date-format="MM/dd/yyyy" stop-on-errors="false" map-null="false" map-empty-string="false">
<class-a>sourcePackage.ABean</class-a>
<class-b>disPackage.A</class-b>
<field>
<a>aa</a>
<b>aa</b>
<a-hint>sourcePackage.AABean</a-hint>
<b-hint>disPackage.AA</b-hint>
</field>
<field>
<a>aa</a>
<b>aa</b>
<a-hint>sourcePackage.aa</a-hint>
<b-hint>disPackage.aa</b-hint>
</field>
</mapping>
<mapping type="one-way" date-format="MM/dd/yyyy" stop-on-errors="true" map-null="false" map-empty-string="false">
<class-a>sourcePackage.aa</class-a>
<class-b>disPackage.aa</class-b>
<field>
<a>b</a>
<b>b</b>
<a-hint>sourcePackage.BBean</a-hint>
<b-hint>disPackage.B</b-hint>
</field>
</mapping>
<mapping type="one-way" date-format="MM/dd/yyyy" stop-on-errors="true" map-null="false" map-empty-string="false">
<class-a>sourcePackage.BBean</class-a>
<class-b>disPackage.B</class-b>
<field>
<a>c</a>
<b>c</b>
</field>
</mapping>
</mappings>
bean列表AABean有一个值,但是在映射之后AA为null,我试图通过在第一个映射中使用点来深入映射但是也不起作用, 请任何人都可以帮助我
答案 0 :(得分:0)
映射应该与简单的ABean到A映射一起使用
<mapping map-id="ray">
<class-a>packare.ABean</class-a>
<class-b>package.A</class-b>
</mapping>