Hi Stephane,

My ComponentImpl object did implement equals() as detailed below, but  the
Option interface included only getCode() and getName(), causing the
comparison to somehow complete incorrectly.  I added the getId() also used
in equals() to the Option interface and it worked.  

Thank you,
Alex./

public class ComponentImpl extends DataObjectImpl implements Component{
   private static final long serialVersionUID = 1L;
   private int     id;
   private String  code         = NULL_STRING;
   private String  name         = NULL_STRING;
   public boolean equals(Object o) {
      if (this == o) {
         return true;
      }

      if (o == null || !(o instanceof ComponentImpl)) {
         return false;
      }

      ComponentImpl component = (ComponentImpl) o;

      if (component.getId() == this.getId()) {
         return true;
      }

      // If both component have their code set up, then it's quite a simple
check....
      if (component.getCode() != null && this.getCode() != null &&
this.getCode() != NULL_STRING ) {
         return component.getCode().equals(this.getCode());
      }

      return false;
   }
--
View this message in context: 
http://www.nabble.com/PropertySelection-t1716999.html#a4667056
Sent from the Tapestry - User forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to