【发布时间】:2016-01-15 16:05:50
【问题描述】:
我正在公开一个使用另一个 SOAP 服务的服务。我得到了一个 JAXB 生成的服务模型。当我使用服务时,数据被设置到与该模型相关的对象中。我已经定义了自己的域模型,它具有与 JAXB 模型完全相同的类集,但没有 xml 注释等。我正在使用推土机来执行数据映射。当某些标有注释 (nillable=true) 的布尔元素为 null 时,我的域模型中的目标对象 Boolean 对象设置为默认值 true 或 false 值。我希望它保留相同的空值。下面列出了布尔变量的映射和定义。
<mapping>
<class-a>com.customer.types.CustomerPreferences
</class-a>
<class-b>com.customer.types.xml.CustomerPreferences
</class-b>
<field>
<a is-accessible="true">isRequired</a>
<b is-accessible="true">isRequired</b>
</field>
</mapping>
JAXB 模型
@javax.xml.bind.annotation.XmlElement(nillable=true)
protected java.lang.Boolean isRequired;
// getters and setters
领域模型
private Boolean isRequired;
//getters and setters
【问题讨论】:
标签: java jaxb spring-boot jackson dozer