SubmitRecord: Add equals and hashCode methods

Change-Id: I0146eeefa4b552e5e39d6138fc6285a3a017a046
This commit is contained in:
Dave Borowitz 2014-01-30 14:24:32 -08:00
parent 1b93f8bd68
commit 17c9a59e81

View File

@ -17,6 +17,7 @@ package com.google.gerrit.common.data;
import com.google.gerrit.reviewdb.client.Account;
import java.util.List;
import java.util.Objects;
/**
* Describes the state required to submit a change.
@ -94,6 +95,22 @@ public class SubmitRecord {
}
return sb.toString();
}
@Override
public boolean equals(Object o) {
if (o instanceof Label) {
Label l = (Label) o;
return Objects.equals(label, l.label)
&& Objects.equals(status, l.status)
&& Objects.equals(appliedBy, l.appliedBy);
}
return false;
}
@Override
public int hashCode() {
return Objects.hash(label, status, appliedBy);
}
}
@Override
@ -114,4 +131,20 @@ public class SubmitRecord {
sb.append(']');
return sb.toString();
}
@Override
public boolean equals(Object o) {
if (o instanceof SubmitRecord) {
SubmitRecord r = (SubmitRecord) o;
return Objects.equals(status, r.status)
&& Objects.equals(labels, r.labels)
&& Objects.equals(errorMessage, r.errorMessage);
}
return false;
}
@Override
public int hashCode() {
return Objects.hash(status, labels, errorMessage);
}
}