title: Is the Java clone() method the only way to achieve polymorphic cloning?
body: <p>I need to equip my class with polymorphic cloning (deep copy), i.e. I need something like this to work:</p>
  
  <pre><code>SuperType original = new SubType();
  SuperType copy = original.clone();
  </code></pre>
  
  <p>where <code>original.clone()</code> can be substituted by any mechanism to create a deep copy, and the actual type of <code>copy</code> shall be <code>SubType</code>, because <code>original</code> is also a <code>SubType</code>.</p>
  
  <p>Is the <code>clone()</code> method and <code>Cloneable</code> interface the only way to achieve this? Factory methods and copy constructors cannot by used, since the actual class is known only in run time, right? Are there any other suggested methods except those serialize-deserialize approaches, and the <a href="http://code.google.com/p/cloning/" rel="noreferrer">Java deep-cloning library</a> which is IMHO even worse black magic than the <code>clone()</code> method?</p>
  
  <p>Thanks, Petr</p>