Skip to content

Commit 662f57f

Browse files
author
Ajay Kannan
committed
remove unncessary changes to ListValue
1 parent 274b9ae commit 662f57f

2 files changed

Lines changed: 4 additions & 13 deletions

File tree

gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/BaseEntity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ public B set(String name, List<? extends Value<?>> values) {
370370
* @param others other values in the list
371371
*/
372372
public B set(String name, Value<?> first, Value<?> second, Value<?>... others) {
373-
properties.put(name, of(first, second, others));
373+
properties.put(name, ListValue.builder().addValue(first).addValue(second, others).build());
374374
return self();
375375
}
376376

gcloud-java-datastore/src/main/java/com/google/gcloud/datastore/ListValue.java

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,16 @@ private Builder() {
7070
super(ValueType.LIST);
7171
}
7272

73-
public Builder addValue(Value<?> value) {
73+
private void addValueHelper(Value<?> value) {
7474
// see datastore_v1.proto definition for list_value
7575
Preconditions.checkArgument(value.type() != ValueType.LIST, "Cannot contain another list");
7676
listBuilder.add(value);
77-
return this;
7877
}
7978

8079
public Builder addValue(Value<?> first, Value<?>... other) {
81-
addValue(first);
80+
addValueHelper(first);
8281
for (Value<?> value : other) {
83-
addValue(value);
82+
addValueHelper(value);
8483
}
8584
return this;
8685
}
@@ -125,10 +124,6 @@ public ListValue(Value<?> first, Value<?>... other) {
125124
this(new Builder().addValue(first, other));
126125
}
127126

128-
ListValue(Value<?> first, Value<?> second, Value<?>... other) {
129-
this(new Builder().addValue(first).addValue(second, other));
130-
}
131-
132127
private ListValue(Builder builder) {
133128
super(builder);
134129
}
@@ -146,10 +141,6 @@ public static ListValue of(Value<?> first, Value<?>... other) {
146141
return new ListValue(first, other);
147142
}
148143

149-
static ListValue of(Value<?> first, Value<?> second, Value<?>... other) {
150-
return new ListValue(first, second, other);
151-
}
152-
153144
public static Builder builder() {
154145
return new Builder();
155146
}

0 commit comments

Comments
 (0)