title: Java creating instance getter easily and quickly
body: <p>I am storing classes like <code>House</code>, <code>Car</code>, <code>Clothes</code>, <code>FacialFeatures</code>; all parts of a <code>Person</code> in a <code>HashMap</code>:</p>
  
  <pre><code>public class Person {
      private HashMap&lt;String, PersonalItem&gt; map = new HashMap&lt;String, PersonalItem&gt;();
  
      public void init(){
          map.put("house", new House());
          map.put("car", new Car());
          map.put("clothes", new Clothes());
          //etc...
  
      }
  
      public PersonalItem getPersonalItem(String name){
          return map.get(name);
      }
  }
  </code></pre>
  
  <p>external usage:</p>
  
  <pre><code>public static void main(String[] args){
  Person person = getPerson(args);
  
  //if i want to use car.setColor(blue); i have to do:
  
      ((Car) person.getPersonalItem("car")).setColor(blue);
  
  //or if i want to use house.setExterior(wooden); i have to do:
  
      ((House) person.getPersonalItem("house")).setExterior(wooden); 
  
  }
  </code></pre>
  
  <p>How can I make it so if I were to use the following code:</p>
  
  <pre><code>person.getPersonalItem("house").setExterior(wooden);
  </code></pre>
  
  <p>It would work and <code>getPersonalItem</code> would return <code>Object instanceof House</code> if the input is "house." I don't want to have to write out a getter every time:</p>
  
  <pre><code>public House getPersonalItemHouse(){
      return (House) map.get("house");
  }
  </code></pre>
  
  <p>Is there an alternative?</p>