blob: 6d28fc256f7dffdac8a824483c7553d554241b13 [file] [log] [blame]
Madan Jampani08822c42014-11-04 17:17:46 -08001package org.onlab.onos.store.service;
2
Yuta HIGUCHI5e1cfe02014-11-04 21:22:45 -08003import com.google.common.base.MoreObjects;
4
Madan Jampani08822c42014-11-04 17:17:46 -08005
6/**
7 * Database read result.
8 */
9public class ReadResult {
10
11 private final String tableName;
12 private final String key;
13 private final VersionedValue value;
14
15 public ReadResult(String tableName, String key, VersionedValue value) {
16 this.tableName = tableName;
17 this.key = key;
18 this.value = value;
19 }
20
21 /**
Madan Jampani9b19a822014-11-04 21:37:13 -080022 * Returns database table name.
Yuta HIGUCHI5e1cfe02014-11-04 21:22:45 -080023 * @return table name
Madan Jampani08822c42014-11-04 17:17:46 -080024 */
25 public String tableName() {
26 return tableName;
27 }
28
29 /**
Madan Jampani9b19a822014-11-04 21:37:13 -080030 * Returns database table key.
Yuta HIGUCHI5e1cfe02014-11-04 21:22:45 -080031 * @return key
Madan Jampani08822c42014-11-04 17:17:46 -080032 */
33 public String key() {
34 return key;
35 }
36
37 /**
Madan Jampani9b19a822014-11-04 21:37:13 -080038 * Returns value associated with the key.
Madan Jampani08822c42014-11-04 17:17:46 -080039 * @return non-null value if the table contains one, null otherwise.
40 */
41 public VersionedValue value() {
42 return value;
43 }
Yuta HIGUCHI5e1cfe02014-11-04 21:22:45 -080044
45 @Override
46 public String toString() {
47 return MoreObjects.toStringHelper(getClass())
48 .add("tableName", tableName)
49 .add("key", key)
50 .add("value", value)
51 .toString();
52 }
Madan Jampani08822c42014-11-04 17:17:46 -080053}