Yuta HIGUCHI

add hashCode to ReadRequest

Change-Id: I2e74047ee65bd2122214eeb582efa70a28b1a1f5
...@@ -2,6 +2,8 @@ package org.onlab.onos.store.service; ...@@ -2,6 +2,8 @@ package org.onlab.onos.store.service;
2 2
3 import static com.google.common.base.Preconditions.checkNotNull; 3 import static com.google.common.base.Preconditions.checkNotNull;
4 4
5 +import java.util.Objects;
6 +
5 import com.google.common.base.MoreObjects; 7 import com.google.common.base.MoreObjects;
6 8
7 /** 9 /**
...@@ -12,7 +14,6 @@ public class ReadRequest { ...@@ -12,7 +14,6 @@ public class ReadRequest {
12 private final String tableName; 14 private final String tableName;
13 private final String key; 15 private final String key;
14 16
15 -
16 /** 17 /**
17 * Creates a read request, 18 * Creates a read request,
18 * which will retrieve the specified key from the table. 19 * which will retrieve the specified key from the table.
...@@ -53,4 +54,26 @@ public class ReadRequest { ...@@ -53,4 +54,26 @@ public class ReadRequest {
53 .add("key", key) 54 .add("key", key)
54 .toString(); 55 .toString();
55 } 56 }
57 +
58 + @Override
59 + public int hashCode() {
60 + return Objects.hash(key, tableName);
61 + }
62 +
63 + @Override
64 + public boolean equals(Object obj) {
65 + if (this == obj) {
66 + return true;
67 + }
68 + if (obj == null) {
69 + return false;
70 + }
71 + if (getClass() != obj.getClass()) {
72 + return false;
73 + }
74 + ReadRequest other = (ReadRequest) obj;
75 + return Objects.equals(this.key, other.key) &&
76 + Objects.equals(this.tableName, other.tableName);
77 + }
78 +
56 } 79 }
...\ No newline at end of file ...\ No newline at end of file
......