java - Making @XmlTransient annotation just for serializing? -
i use spring , apache cxf project implements java web services first-code style.
i have variable defined:
@xmltransient public string word; so variable doesn't map attribute @ xml.
however want ignored mapping xml element @ serialization not @ deserialization.
how can that?
i don't think can achieve @xmltransient. option use moxy marshal using 1 schema , unmarshal using schema. can find great example here.
a simple less elegant workaround this:
@xmltransient public string word; public void setdeserializedword(string word) { this.word = word; } @xmlelement(name="word") public string getdeserializedword() { return null; }
Comments
Post a Comment