package org.onlab.onos.store.service;

import static com.google.common.base.Preconditions.checkNotNull;

import com.google.common.base.MoreObjects;

/**
 * Database read request.
 */
public class ReadRequest {

    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 = checkNotNull(tableName);
        this.key = checkNotNull(key);
    }

    /**
     * Return the name of the table.
     * @return table name.
     */
    public String tableName() {
        return tableName;
    }

    /**
     * Returns the key.
     * @return key.
     */
    public String key() {
        return key;
    }

    @Override
    public String toString() {
        return MoreObjects.toStringHelper(getClass())
                .add("tableName", tableName)
                .add("key", key)
                .toString();
    }
}
@@ -98,16 +98,43 @@
 tNull;%0A%0A
+import java.util.Objects;%0A%0A
 import c
@@ -298,17 +298,16 @@
 g key;%0A%0A
-%0A
     /**%0A
@@ -1264,9 +1264,536 @@
 ;%0A    %7D%0A
+%0A    @Override%0A    public int hashCode() %7B%0A        return Objects.hash(key, tableName);%0A    %7D%0A%0A    @Override%0A    public boolean equals(Object obj) %7B%0A        if (this == obj) %7B%0A            return true;%0A        %7D%0A        if (obj == null) %7B%0A            return false;%0A        %7D%0A        if (getClass() != obj.getClass()) %7B%0A            return false;%0A        %7D%0A        ReadRequest other = (ReadRequest) obj;%0A        return Objects.equals(this.key, other.key) &&%0A                Objects.equals(this.tableName, other.tableName);%0A    %7D%0A%0A
 %7D

add hashCode to ReadRequest