title: How to Map unset property to value without getting NullPointerException in Dozer
body: <p>Using Dozer to map two objects, I have:</p>
  
  <pre><code>/**
  /* This first class uses the GXT (ExtJS) framework
  **/
  Class1 extends BaseModelData
  {
      public int getId()
      {
          return (Integer)get("id");
      }
  
      public void setId(int id)
      {
          set("id", id);
      }
  
      // more properties
  }
  
  Class2
  {
      public int getId()
      {
          return id;
      }
  
      public void setId(int id)
      {
          this.id = id;
      }
  
      // more properties
  }
  </code></pre>
  
  <p>If I don't set the Id in the first class (by calling class1.setId()) the result is a NullPointerException from Dozer. I understand that this is correct as get("id") would be null. </p>
  
  <p>I can of course resolve this by putting in a check for null, and returning -1 or 0, or whatever.</p>
  
  <p>The problem is that this then becomes a runtime error rather than a compile time error. I'd much prefer to resolve this correctly.</p>
  
  <p>Now I've read in the <a href="http://dozer.sourceforge.net/documentation/exclude.html" rel="nofollow noreferrer">Dozer documentation that you can have it skip null by doing map-null="false"</a>, but I couldn't get this to work...</p>
  
  <p>Any suggestions?</p>