title: Xstream: Implicitly ignoring all fields
body: <p>How do I tell Xstream to serialize only fields which are annotated explicitly and ignore the rest?   </p>
  
  <p>I am trying to serialize a hibernate persistent object and all proxy related fields get serialized which I don’t want in my xml.<br>
  e.g.  </p>
  
  <pre><code>&lt;createdBy class="com..domain.Users " reference="../../values/createdBy"/&gt;
  </code></pre>
  
  <p>is not something I want in my xml.  </p>
  
  <p><strong>Edit:</strong> I don’t think I made this question clear. A class may inherit from a base class on which I have no control (as in hibernate’s case) on the base class properties.  </p>
  
  <pre><code>public class A {
      private String ShouldNotBeSerialized;
  }
  
  public class B extends A {
      @XStreamAlias("1")
      private String ThisShouldbeSerialized;
  }
  </code></pre>
  
  <p>In this case when I serialize class B, the base class field <em>ShouldNotBeSerialized</em> will also get serialized. This is not something I want. In most circumstances I will not have control on class A.  </p>
  
  <p>Therefore I want to <strong>omit all fields by default</strong> and serialize only fields for which I <strong>explicitly specify</strong> the annotation. I want to avoid what <a href="https://stackoverflow.com/questions/1998282/xstream-explicitly-specifying-fields-to-serialize/1998385#1998385">GaryF</a> is doing, where I need to explicitly specify the fields I need to omit.</p>