将父元素设置为 null,映射的子元素为 null - Dozer
Setting parent element to null which mapped child element is null - Dozer
我已经使用 JAXB 生成了 classed。它为一些复杂的元素生成了列表。我提供了一个由 JaxB -
生成的 class 的例子
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ArrayOfLineOfBusiness", propOrder = {
"lineOfBusiness"
})
public class ArrayOfLineOfBusiness
implements Serializable
{
private final static long serialVersionUID = 11082011L;
protected com.comcast.xml.epc.types.LineOfBusiness[] lineOfBusiness;
}
ArrayOfLineOfBusiness 用于 Customer class
public class Customer{
@XmlElement(nillable = true)
protected ArrayOfLineOfBusiness linesOfBusiness;
我的模型 class 与下面类似:
public class Customer implements Serializable {
private LineOfBusiness[] linesOfBusiness = null;
下面是我的推土机映射
<field>
<a is-accessible="true">lineOfBusiness.lineOfBusinesses</a>
<b>lineOfBusiness</b>
</field>
如果我的服务模型中的 lineOfBusinesses 数组为空,我想设置 ArrayOfLineOfBusiness 。有办法吗?
下面的映射似乎解决了这个场景 -
<mapping map-null="false">
我已经使用 JAXB 生成了 classed。它为一些复杂的元素生成了列表。我提供了一个由 JaxB -
生成的 class 的例子@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ArrayOfLineOfBusiness", propOrder = {
"lineOfBusiness"
})
public class ArrayOfLineOfBusiness
implements Serializable
{
private final static long serialVersionUID = 11082011L;
protected com.comcast.xml.epc.types.LineOfBusiness[] lineOfBusiness;
}
ArrayOfLineOfBusiness 用于 Customer class
public class Customer{
@XmlElement(nillable = true)
protected ArrayOfLineOfBusiness linesOfBusiness;
我的模型 class 与下面类似:
public class Customer implements Serializable {
private LineOfBusiness[] linesOfBusiness = null;
下面是我的推土机映射
<field>
<a is-accessible="true">lineOfBusiness.lineOfBusinesses</a>
<b>lineOfBusiness</b>
</field>
如果我的服务模型中的 lineOfBusinesses 数组为空,我想设置 ArrayOfLineOfBusiness 。有办法吗?
下面的映射似乎解决了这个场景 -
<mapping map-null="false">