If I have a class annotated with
@XmlType(name = "someDTO", propOrder = {
"firstField",
"secondField",
})
but the XML (from a SOAP response, say) looks like
<return><firstField>a</firstField><secondField>b</secondField><thirdField>c</thirdField></return>
My object will still get firstField and secondField populated, and thirdField is ignored.
Why is this? Will this always be the case? Is there a way to prevent object creation if extra fields are present?
Some JAXB (JSR-222) implementations will complain if there are properties mapped to XML elements that are not included in the propOrder
. propOder
on @XmlType
is not used to control which elements are included/excluded.
Options for Excluding Properties
@XmlTransient
.@XmlAccessorType(XmlAccessType.NONE)
and annotating the properties you wish to include.For More Information
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With