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

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -