title: XmlTransient annotation on getter only?
body: <p>I am trying to unmarshal an XML into an object that I expect should have a certain field. However, I do not want to marshal that object into an XML that contains it. What I like would be similar to this:</p>
  
  <pre><code>@XmlRootElement(name = "User")
  public class User {
  
      private String name;
  
      @XmlTransient
      public String getName() {
          return this.name
      }
  
      @XmlElement(name = "Name")
      public void setName(String name) {
          this.name = name
      }
  }
  </code></pre>
  
  <p>However, this would not work due to the conflicting annotations, as I can't use any other XML annotations with <code>@XmlTransient</code>. I have also tried to add the <code>@XmlTransient</code> annotation on the field itself instead of the getter and have set this option: </p>
  
  <p><code>XmlAccessorType(XmlAccessType.FIELD)</code> </p>
  
  <p>In addition, I kept the <code>@XmlElement</code> annotation on the setter, and that did absolutely nothing in terms of excluding the field from being marshalled.</p>
  
  <p>I would like to keep the <code>@XmlElement</code> annotation, since I like being able to translate a field with a different name (here it is just a capitalization difference) into whichever field I want. </p>
  
  <p>I also cannot delete the getter, as I do use it in the application.</p>
  
  <p>Given that, I don't know what my options are at this point, other than writing an adapter (which I could do, but if there is another solution, I'd rather not use a custom adapter because of this one field). Any help would be greatly appreciated.</p>