add Factory method to ReadRequest
Change-Id: I713b25ff6165b072e647be0dfa63eab97dc5ca85
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 a22464a..8bcf8b4 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
@@ -1,5 +1,7 @@
package org.onlab.onos.store.service;
+import static com.google.common.base.Preconditions.checkNotNull;
+
import com.google.common.base.MoreObjects;
/**
@@ -10,9 +12,22 @@
private final String tableName;
private final String key;
+
+ /**
+ * Creates a read request,
+ * which will retrieve the specified key from the table.
+ *
+ * @param tableName name of the table
+ * @param key key in the table
+ * @return ReadRequest
+ */
+ public static ReadRequest get(String tableName, String key) {
+ return new ReadRequest(tableName, key);
+ }
+
public ReadRequest(String tableName, String key) {
- this.tableName = tableName;
- this.key = key;
+ this.tableName = checkNotNull(tableName);
+ this.key = checkNotNull(key);
}
/**