Skip to content

Commit

Permalink
Improve some toString expressions of Selection Operators (#920)
Browse files Browse the repository at this point in the history
  • Loading branch information
komamitsu authored and brfrn169 committed Jun 30, 2023
1 parent bf4d391 commit 26d5160
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 39 deletions.
6 changes: 0 additions & 6 deletions core/src/main/java/com/scalar/db/api/GetWithIndex.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.scalar.db.api;

import com.google.common.base.MoreObjects;
import com.scalar.db.io.Key;
import java.util.Collection;
import java.util.Objects;
Expand Down Expand Up @@ -97,9 +96,4 @@ public boolean equals(Object o) {
public int hashCode() {
return Objects.hash(super.hashCode());
}

@Override
public String toString() {
return super.toString() + MoreObjects.toStringHelper(this);
}
}
21 changes: 13 additions & 8 deletions core/src/main/java/com/scalar/db/api/Scan.java
Original file line number Diff line number Diff line change
Expand Up @@ -337,14 +337,19 @@ public int hashCode() {

@Override
public String toString() {
return super.toString()
+ MoreObjects.toStringHelper(this)
.add("startClusteringKey", startClusteringKey)
.add("startInclusive", startInclusive)
.add("endClusteringKey", endClusteringKey)
.add("endInclusive", endInclusive)
.add("orderings", orderings)
.add("limit", limit);
return MoreObjects.toStringHelper(this)
.add("namespace", forNamespace())
.add("table", forTable())
.add("partitionKey", getPartitionKey())
.add("projections", getProjections())
.add("consistency", getConsistency())
.add("startClusteringKey", startClusteringKey)
.add("startInclusive", startInclusive)
.add("endClusteringKey", endClusteringKey)
.add("endInclusive", endInclusive)
.add("orderings", orderings)
.add("limit", limit)
.toString();
}

/** An optional parameter of {@link Scan} command to specify ordering of returned results. */
Expand Down
6 changes: 0 additions & 6 deletions core/src/main/java/com/scalar/db/api/ScanAll.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.scalar.db.api;

import com.google.common.base.MoreObjects;
import com.scalar.db.io.Key;
import java.util.Collection;
import java.util.Objects;
Expand Down Expand Up @@ -174,9 +173,4 @@ public boolean equals(Object o) {
public int hashCode() {
return Objects.hash(super.hashCode());
}

@Override
public String toString() {
return super.toString() + MoreObjects.toStringHelper(this);
}
}
6 changes: 0 additions & 6 deletions core/src/main/java/com/scalar/db/api/ScanWithIndex.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.scalar.db.api;

import com.google.common.base.MoreObjects;
import com.scalar.db.io.Key;
import java.util.Collection;
import java.util.Objects;
Expand Down Expand Up @@ -166,9 +165,4 @@ public boolean equals(Object o) {
public int hashCode() {
return Objects.hash(super.hashCode());
}

@Override
public String toString() {
return super.toString() + MoreObjects.toStringHelper(this);
}
}
13 changes: 0 additions & 13 deletions core/src/main/java/com/scalar/db/api/Selection.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.scalar.db.api;

import com.google.common.base.MoreObjects;
import com.scalar.db.io.Key;
import java.util.ArrayList;
import java.util.Collection;
Expand Down Expand Up @@ -110,16 +109,4 @@ public boolean equals(Object o) {
public int hashCode() {
return Objects.hash(super.hashCode(), projections);
}

@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("namespace", forNamespace())
.add("table", forTable())
.add("partitionKey", getPartitionKey())
.add("clusteringKey", getClusteringKey())
.add("projections", getProjections())
.add("consistency", getConsistency())
.toString();
}
}

0 comments on commit 26d5160

Please sign in to comment.