Yuta HIGUCHI

add toString

Change-Id: I2a38b27164c4c4c0e259a32dbb283dd384b61c26
package org.onlab.onos.store.service;
import com.google.common.base.MoreObjects;
/**
* Database read request.
*/
......@@ -31,6 +33,9 @@ public class ReadRequest {
@Override
public String toString() {
return "ReadRequest [tableName=" + tableName + ", key=" + key + "]";
return MoreObjects.toStringHelper(getClass())
.add("tableName", tableName)
.add("key", key)
.toString();
}
}
\ No newline at end of file
......
package org.onlab.onos.store.service;
import com.google.common.base.MoreObjects;
/**
* Database read result.
......@@ -18,7 +20,7 @@ public class ReadResult {
/**
* Returns database table name.
* @return table name.
* @return table name
*/
public String tableName() {
return tableName;
......@@ -26,7 +28,7 @@ public class ReadResult {
/**
* Returns database table key.
* @return key.
* @return key
*/
public String key() {
return key;
......@@ -39,4 +41,13 @@ public class ReadResult {
public VersionedValue value() {
return value;
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass())
.add("tableName", tableName)
.add("key", key)
.add("value", value)
.toString();
}
}
......
......@@ -2,6 +2,8 @@ package org.onlab.onos.store.service;
import java.util.Arrays;
import com.google.common.base.MoreObjects;
/**
* Wrapper object that holds the object (as byte array) and its version.
*/
......@@ -38,7 +40,9 @@ public class VersionedValue {
@Override
public String toString() {
return "VersionedValue [value=" + Arrays.toString(value) + ", version="
+ version + "]";
return MoreObjects.toStringHelper(getClass())
.add("version", version)
.add("value", Arrays.toString(value))
.toString();
}
}
......
......@@ -4,6 +4,8 @@ import static com.google.common.base.Preconditions.checkArgument;
import java.util.Objects;
import com.google.common.base.MoreObjects;
/**
* Database write request.
*/
......@@ -67,10 +69,13 @@ public class WriteRequest {
@Override
public String toString() {
return "WriteRequest [tableName=" + tableName + ", key=" + key
+ ", newValue=" + newValue
+ ", previousVersion=" + previousVersion
+ ", oldValue=" + oldValue;
return MoreObjects.toStringHelper(getClass())
.add("tableName", tableName)
.add("key", key)
.add("newValue", newValue)
.add("previousVersion", previousVersion)
.add("oldValue", oldValue)
.toString();
}
@Override
......
package org.onlab.onos.store.service;
import com.google.common.base.MoreObjects;
/**
* Database write result.
......@@ -27,4 +29,13 @@ public class WriteResult {
public VersionedValue previousValue() {
return previousValue;
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass())
.add("tableName", tableName)
.add("key", key)
.add("previousValue", previousValue)
.toString();
}
}
......