title: Get instance of subclass with superclass static method
body: <p>I have a superclass that I would like to forward a static method called <code>getInstance()</code> to all subclasses.</p>
  
  <p>When creating an instance of a subclass, I then register the instance in the superclass (perhaps using a hashtable, where the key is based on <code>getClass()</code>).  Then, I wish to use the aforementioned static method ( <code>getInstance</code> ) where the superclass method will return the instance of the correct type. </p>
  
  <p>For example, I have a superclass A, and a subclass B extends A.
  I want to write a static method <code>A.getInstance()</code>; when called from B (<code>B.getInstance()</code>), I would like it to return the instance of B that I stored earlier.</p>
  
  <p>Its kinda hard to explain, but I am going to be using this superclass a lot, and I would rather not code a <code>getInstance</code> method into every single subclass.</p>
  
  <p>How would I go about doing something like this?</p>
  
  <p>edit: I just realized that my question may be misconstrued as creating a NEW instance of the object. I have already created the instance, and i wish to get the existing instance of the class</p>