@SuppressWarnings("unchecked") @Override public boolean equals(Object object) { if (!(object instanceof JcrItemModel)) { return false; } if (this == object) { return true; } JcrItemModel that = (JcrItemModel) object; // Two Objects that compare as equals must generate the same hash code, // but two Objects with the same hash code do not have to be equal. // this implicitly calls the save method when needed if (this.hashCode() != that.hashCode()) { return false; } if (this.uuid != null && !this.uuid.equals(that.uuid)) { return false; } if (this.relPath == null && that.relPath == null) { return true; } else { return this.relPath != null && this.relPath.equals(that.relPath); } }
@Override public int hashCode() { return getItemModel().hashCode(); }