Yuta HIGUCHI

add Factory method to ReadRequest

Change-Id: I713b25ff6165b072e647be0dfa63eab97dc5ca85
1 package org.onlab.onos.store.service; 1 package org.onlab.onos.store.service;
2 2
3 +import static com.google.common.base.Preconditions.checkNotNull;
4 +
3 import com.google.common.base.MoreObjects; 5 import com.google.common.base.MoreObjects;
4 6
5 /** 7 /**
...@@ -10,9 +12,22 @@ public class ReadRequest { ...@@ -10,9 +12,22 @@ public class ReadRequest {
10 private final String tableName; 12 private final String tableName;
11 private final String key; 13 private final String key;
12 14
15 +
16 + /**
17 + * Creates a read request,
18 + * which will retrieve the specified key from the table.
19 + *
20 + * @param tableName name of the table
21 + * @param key key in the table
22 + * @return ReadRequest
23 + */
24 + public static ReadRequest get(String tableName, String key) {
25 + return new ReadRequest(tableName, key);
26 + }
27 +
13 public ReadRequest(String tableName, String key) { 28 public ReadRequest(String tableName, String key) {
14 - this.tableName = tableName; 29 + this.tableName = checkNotNull(tableName);
15 - this.key = key; 30 + this.key = checkNotNull(key);
16 } 31 }
17 32
18 /** 33 /**
......