title: How to ask BeanUtils to ignore null values
body: <p>Using Commons beanUtils I would like to know how to ask any converter say the Dateconverter to ignore null values and use null as default. As an example consider a public class,</p>
  
  <pre><code>public class X {
      private Date date1;
      private String string1;
      //add public getters and setters
  }
  </code></pre>
  
  <p>and my convertertest as,</p>
  
  <pre><code>public class Apache {
  
      @Test
      public void testSimple() throws Exception {
          X x1 = new X(), x2 = new X();
          x1.setString1("X");
          x1.setDate1(null);
          org.apache.commons.beanutils.BeanUtils.copyProperties(x2, x1);
          //throws ConversionException
          System.out.println(x2.getString1());
          System.out.println(x2.getDate1());
      }
  }
  </code></pre>
  
  <p>The above throws a NPE since the date happens to be null. This looks a very primitive scenario to me which should be handled by default (as in, I would expect x2 to have null value for date1). The doco tells me that I can ask the <a href="http://commons.apache.org/beanutils/v1.8.3/apidocs/org/apache/commons/beanutils/converters/DateConverter.html" rel="noreferrer">converter</a> to do this. Can someone point me as to the best way for doing this ? </p>
  
  <p>I dont want to get hold of the Converter and isUseDefault() to be true because then I have to do it for all Date, Enum and many other converters !</p>