mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-21 12:22:18 +02:00
Add equals() methods because hashCode() was defined
These are reported as 'Blocker' bugs by SonarQube Change-Id: I6c25e365522f26e9f50b67a57878ad75c42aa9d2
This commit is contained in:
parent
dde22ae5f4
commit
30edb16a05
@ -48,6 +48,20 @@ public class Leadership {
|
||||
return Objects.hash(topic, leader, epoch);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj instanceof Leadership) {
|
||||
final Leadership other = (Leadership) obj;
|
||||
return Objects.equals(this.topic, other.topic) &&
|
||||
Objects.equals(this.leader, other.leader) &&
|
||||
Objects.equals(this.epoch, other.epoch);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return MoreObjects.toStringHelper(this.getClass())
|
||||
@ -56,4 +70,4 @@ public class Leadership {
|
||||
.add("epoch", epoch)
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -76,6 +76,20 @@ public class LeadershipEvent extends AbstractEvent<LeadershipEvent.Type, Leaders
|
||||
return Objects.hash(type(), subject(), time());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj instanceof LeadershipEvent) {
|
||||
final LeadershipEvent other = (LeadershipEvent) obj;
|
||||
return Objects.equals(this.type(), other.type()) &&
|
||||
Objects.equals(this.subject(), other.subject()) &&
|
||||
Objects.equals(this.time(), other.time());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return MoreObjects.toStringHelper(this.getClass())
|
||||
|
Loading…
x
Reference in New Issue
Block a user