@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (obj == this) { return true; } if (!(obj instanceof Row)) { return false; } Row other = (Row) obj; boolean simpleMatch = (rowId == null ? other.rowId == null : rowId.equals(other.rowId)) && (rowETag == null ? other.rowETag == null : rowETag.equals(other.rowETag)) && (dataETagAtModification == null ? other.dataETagAtModification == null : dataETagAtModification.equals(other.dataETagAtModification)) && (deleted == other.deleted) && (createUser == null ? other.createUser == null : createUser.equals(other.createUser)) && (lastUpdateUser == null ? other.lastUpdateUser == null : lastUpdateUser.equals(other.lastUpdateUser)) && (rowFilterScope == null ? other.rowFilterScope == null : rowFilterScope.equals(other.rowFilterScope)) && (savepointCreator == null ? other.savepointCreator == null : savepointCreator.equals(other.savepointCreator)) && (formId == null ? other.formId == null : formId.equals(other.formId)) && (locale == null ? other.locale == null : locale.equals(other.locale)) && (savepointType == null ? other.savepointType == null : savepointType.equals(other.savepointType)) && (savepointTimestamp == null ? other.savepointTimestamp == null : savepointTimestamp.equals(other.savepointTimestamp)) && (orderedColumns == null ? other.orderedColumns == null : (other.orderedColumns != null && orderedColumns.size() == other.orderedColumns.size())); if (!simpleMatch) { return false; } if (orderedColumns == null) { return true; } // columns are ordered... compare one-to-one for (int i = 0; i < orderedColumns.size(); ++i) { if (!orderedColumns.get(i).equals(other.orderedColumns.get(i))) { return false; } } return true; }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((rowId == null) ? 0 : rowId.hashCode()); result = prime * result + ((rowETag == null) ? 0 : rowETag.hashCode()); result = prime * result + ((dataETagAtModification == null) ? 0 : dataETagAtModification.hashCode()); result = prime * result + ((deleted) ? 0 : 1); result = prime * result + ((createUser == null) ? 0 : createUser.hashCode()); result = prime * result + ((lastUpdateUser == null) ? 0 : lastUpdateUser.hashCode()); result = prime * result + ((rowFilterScope == null) ? 0 : rowFilterScope.hashCode()); result = prime * result + ((savepointCreator == null) ? 0 : savepointCreator.hashCode()); result = prime * result + ((formId == null) ? 0 : formId.hashCode()); result = prime * result + ((locale == null) ? 0 : locale.hashCode()); result = prime * result + ((savepointType == null) ? 0 : savepointType.hashCode()); result = prime * result + ((savepointTimestamp == null) ? 0 : savepointTimestamp.hashCode()); result = prime * result + ((orderedColumns == null) ? 0 : orderedColumns.hashCode()); return result; }
/** * A reduced-function equals predicate to detect if the values significant to the end user are * matched across the two data records. * * <p>Ignore the following fields when making this comparison: * * <ul> * <li>rowETag * <li>dataETagAtModification * <li>createUser * <li>lastUpdateUser * </ul> * * @param other * @return */ public boolean hasMatchingSignificantFieldValues( Row other, Comparator<DataKeyValue> deepComparator) { if (other == null) return false; boolean simpleMatch = (rowId == null ? other.rowId == null : rowId.equals(other.rowId)) && (deleted == other.deleted) && (rowFilterScope == null ? other.rowFilterScope == null : rowFilterScope.equals(other.rowFilterScope)) && (formId == null ? other.formId == null : formId.equals(other.formId)) && (locale == null ? other.locale == null : locale.equals(other.locale)) && (savepointType == null ? other.savepointType == null : savepointType.equals(other.savepointType)) && (savepointTimestamp == null ? other.savepointTimestamp == null : savepointTimestamp.equals(other.savepointTimestamp)) && (savepointCreator == null ? other.savepointCreator == null : savepointCreator.equals(other.savepointCreator)) && (orderedColumns == null ? other.orderedColumns == null : (other.orderedColumns != null && orderedColumns.size() == other.orderedColumns.size())); if (!simpleMatch) { return false; } if (orderedColumns == null) { return true; } // columns are ordered... compare one-to-one for (int i = 0; i < orderedColumns.size(); ++i) { if (deepComparator.compare(orderedColumns.get(i), other.orderedColumns.get(i)) != 0) { return false; } } return true; }