我正在研究使用REST构建的API(使用jersey框架)。
我创建了一个输入表单模式:
<xs:complexType name="InputForm">
<xs:sequence>
<xs:element name="A" type="xs:boolean" />
<xs:element name="B" type="xs:string" default="xyz" />
</xs:sequence>
</xs:completeType>
生成的java文件是:
public class InputForm{
@XmlElement(defaultValue = "true")
protected boolean A;
@XmlElement(required = true, defaultValue = "xyz")
protected String B;
}
使用各自的set和get方法。
现在我以json格式发送我的有效载荷:
{
"A":"true"
}
在这种情况下,B未采用其指定的默认值。请说明可能的原因。根据{{3}},B应采用指定的默认值