/** @see java.lang.Comparable#compareTo(java.lang.Object) */ public int compareTo(PersonAddress other) { int retValue = 0; if (other != null) { retValue = isVoided().compareTo(other.isVoided()); if (retValue == 0) retValue = other.isPreferred().compareTo(isPreferred()); if (retValue == 0 && getDateCreated() != null) retValue = OpenmrsUtil.compareWithNullAsLatest(getDateCreated(), other.getDateCreated()); if (retValue == 0) retValue = OpenmrsUtil.compareWithNullAsGreatest(getPersonAddressId(), other.getPersonAddressId()); // if we've gotten this far, just check all address values. If they are // equal, leave the objects at 0. If not, arbitrarily pick retValue=1 // and return that (they are not equal). if (retValue == 0 && !equalsContent(other)) retValue = 1; } return retValue; }