title: Example of an elegant implementation of 'Defensive Copying' of a nullable java.util.Date in a JavaBean's getter/setter implementation?
body: <p>Is there an elegant Java implementation of Joshua Bloch's <a href="http://www.informit.com/articles/article.aspx?p=31551&amp;seqNum=2" rel="nofollow">defensive copying</a> techniques using the example below?  The nullChecking is really the issue I think, but perhaps there is a much simpler way to achieve defensive copying.</p>
  
  <pre><code>   public class Audit {
        private Date dateCompleted;
        ...      
        public Audit() {
          super();
        }
  
        //defensive copy of dateCompleted
        public final Date getDateCompleted() {
          if (dateCompleted != null){
            return new Date(dateCompleted.getTime());
          }else{
            return null;
          }
        }
  
        public final void setDateCompleted(Date dateCompleted) {
          if (dateCompleted != null){
            this.dateCompleted = new Date(dateCompleted.getTime());
          }else{
            this.dateCompleted = null;
          }
        }
        ...
     }  
  </code></pre>