add hashCode to ReadRequest
Change-Id: I2e74047ee65bd2122214eeb582efa70a28b1a1f5
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/service/ReadRequest.java b/core/store/dist/src/main/java/org/onlab/onos/store/service/ReadRequest.java
index 8bcf8b4..9f7af4a 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/service/ReadRequest.java
+++ b/core/store/dist/src/main/java/org/onlab/onos/store/service/ReadRequest.java
@@ -2,6 +2,8 @@
import static com.google.common.base.Preconditions.checkNotNull;
+import java.util.Objects;
+
import com.google.common.base.MoreObjects;
/**
@@ -12,7 +14,6 @@
private final String tableName;
private final String key;
-
/**
* Creates a read request,
* which will retrieve the specified key from the table.
@@ -53,4 +54,26 @@
.add("key", key)
.toString();
}
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(key, tableName);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ ReadRequest other = (ReadRequest) obj;
+ return Objects.equals(this.key, other.key) &&
+ Objects.equals(this.tableName, other.tableName);
+ }
+
}
\ No newline at end of file