title: Wicket Complex Data class for models
body: <p>I'm a starter in using Wicket, and I think I just managed to understand how models work, which is great, but there is a hole in my understanding:</p>
  
  <p>When working with Models for a custom, complex type, let's say <code>Person</code>, then I'll create a <code>PersonData</code> class with the proper fields and getters/setters, then create a <code>PersonModel</code>, which implements the model for this <code>PersonData</code> class, so naturally, I'll have a field with the type <code>PersonData</code>.</p>
  
  <p>Now the question:</p>
  
  <p>When implementing the <code>setObject(Person newObject)</code> method for the Model, is it prefered to copy over the fields of the parameter object, like <code>this.object.setFirstname(newObject.getFirstname())</code>, or can I just copy over the parameter instance, like <code>this.object = newObject;</code>?</p>
  
  <p>With the latter, I of course copy the reference of this instance, so if I set some other model this instance and do some changes to that, then all the other models will change as well, which might be undesirable, that's why the question arose.</p>
  
  <p>What is the better practice in this case?</p>