title: Object "cast template" getter for a map of Objects?
body: <p>I wondered if it was possible to create a "templatized" getter, such as :</p>
  
  <pre><code>class TestGet
  {
      private static Map&lt;String,Object&gt; theMap.....
  
      public static getObject&lt;T&gt;(String key).....
  </code></pre>
  
  <p>And somewhere in the code, something like :</p>
  
  <pre><code>JButton myButton = TestGet.getObject&lt;JButton&gt;("theButton");
  </code></pre>
  
  <p>Beware : this is <em>just</em> an "idle" question, I'm trying to avoid "dirty" casts in my code since they make my eyes bleed each time I look at them.</p>
  
  <p>I know there are more elegant ways to do that, but I really would do it with a map of  to avoid linking with other classes.</p>
  
  <p>I tried out some configurations, but nothing seems to fit what I want to do... Is a templating like that just possible ?</p>