title: When serializing an object, how can I prevent serialization of particular members?
body: <p>I have a class that implements <a href="http://docs.oracle.com/javase/7/docs/api/java/io/Serializable.html" rel="noreferrer"><code>Serializable</code></a>. When I serialize members of that class, there are certain variables/methods that I don't to want included in the serialized representation.</p>
  
  <p>Consider a <code>Name</code> class that is <code>Serializable</code>:</p>
  
  <pre><code>class Name implements Serializable {
      private String firstName;
      private String middleName;
      private String lastName;
  
      ...
  }
  </code></pre>
  
  <p>Suppose I want the serialized form of each instance to exclude the <code>middleName</code> property.</p>
  
  <p>Is there any way I can exclude particular properties and methods from being included in the serialized representation of the object?</p>