title: java singleton of parameterized class
body: <p>I can't get this disentangled.</p>
  
  <pre><code>public class MySingleton&lt;T extends AUsefulClass&gt;{
      Map&lt;String, T&gt; myUsefulRegistry;
      private static MySingleton&lt;T&gt; _instance = null;
  
      public static instance(){
          if(instance == null)
              _instance = new MySingleton&lt;T&gt;();
  
          return _instance;
      }
  }
  
  public class Test{
      @Test
      public void testThis(){
          MySingleton&lt;SomeClass&gt; mySingleton = MySingleton&lt;SomeClass&gt;().instance();
      }
  }
  </code></pre>
  
  <p>This parametrization is faulty because you cannot make a static reference to a nonstatic T. Still, I would like to build a parameterizable singleton class.</p>