Skip to content

Commit 7dd7d1f

Browse files
committed
---
yaml --- r: 55 b: refs/heads/master c: 41422a9 h: refs/heads/master i: 53: 70a1976 51: 0d1ed74 47: b85f58e v: v3
1 parent eefeaaa commit 7dd7d1f

16 files changed

Lines changed: 130 additions & 35 deletions

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 81d22393f43ece2d3cf14f83ad14403ae6a6983a
2+
refs/heads/master: 41422a9d39c4e8c49e1cfa98d32ee2e36ba38c95

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

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
package com.google.gcloud.datastore;
22

3+
import static com.google.gcloud.datastore.BlobValue.of;
4+
import static com.google.gcloud.datastore.BooleanValue.of;
5+
import static com.google.gcloud.datastore.DateTimeValue.of;
6+
import static com.google.gcloud.datastore.DoubleValue.of;
7+
import static com.google.gcloud.datastore.EntityValue.of;
8+
import static com.google.gcloud.datastore.KeyValue.of;
9+
import static com.google.gcloud.datastore.ListValue.of;
10+
import static com.google.gcloud.datastore.LongValue.of;
11+
import static com.google.gcloud.datastore.NullValue.of;
12+
import static com.google.gcloud.datastore.StringValue.of;
13+
314
import com.google.api.services.datastore.DatastoreV1;
415
import com.google.common.collect.ImmutableSortedMap;
516
import com.google.gcloud.datastore.Value.Type;
@@ -58,57 +69,57 @@ public B set(String name, Value<?> value) {
5869
}
5970

6071
public B setNull(String name) {
61-
properties.put(name, new NullValue());
72+
properties.put(name, of());
6273
return self();
6374
}
6475

6576
public B set(String name, String value) {
66-
properties.put(name, new StringValue(value));
77+
properties.put(name, of(value));
6778
return self();
6879
}
6980

7081
public B set(String name, long value) {
71-
properties.put(name, new LongValue(value));
82+
properties.put(name, of(value));
7283
return self();
7384
}
7485

7586
public B set(String name, double value) {
76-
properties.put(name, new DoubleValue(value));
87+
properties.put(name, of(value));
7788
return self();
7889
}
7990

8091
public B set(String name, boolean value) {
81-
properties.put(name, new BooleanValue(value));
92+
properties.put(name, of(value));
8293
return self();
8394
}
8495

8596
public B set(String name, DateTime value) {
86-
properties.put(name, new DateTimeValue(value));
97+
properties.put(name, of(value));
8798
return self();
8899
}
89100

90101
public B set(String name, Key value) {
91-
properties.put(name, new KeyValue(value));
102+
properties.put(name, of(value));
92103
return self();
93104
}
94105

95106
public B set(String name, PartialEntity value) {
96-
properties.put(name, new EntityValue(value));
107+
properties.put(name, of(value));
97108
return self();
98109
}
99110

100111
public B set(String name, List<? extends Value<?>> values) {
101-
properties.put(name, new ListValue(values));
112+
properties.put(name, of(values));
102113
return self();
103114
}
104115

105116
public B set(String name, Value<?>... value) {
106-
properties.put(name, new ListValue(Arrays.asList(value)));
117+
properties.put(name, of(Arrays.asList(value)));
107118
return self();
108119
}
109120

110121
public B set(String name, Blob value) {
111-
properties.put(name, new BlobValue(value));
122+
properties.put(name, of(value));
112123
return self();
113124
}
114125

trunk/src/main/java/com/google/gcloud/datastore/BlobValue.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ public Builder toBuilder() {
5757
return new Builder().mergeFrom(this);
5858
}
5959

60+
public static BlobValue of(Blob blob) {
61+
return new BlobValue(blob);
62+
}
63+
6064
public static Builder builder(Blob blob) {
6165
return new Builder().set(blob);
6266
}

trunk/src/main/java/com/google/gcloud/datastore/BooleanValue.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ public Builder toBuilder() {
5757
return new Builder().mergeFrom(this);
5858
}
5959

60+
public static BooleanValue of(boolean value) {
61+
return new BooleanValue(value);
62+
}
63+
6064
public static Builder builder(boolean value) {
6165
return new Builder().set(value);
6266
}

trunk/src/main/java/com/google/gcloud/datastore/DateTimeValue.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ public Builder toBuilder() {
5858
return new Builder().mergeFrom(this);
5959
}
6060

61+
public static DateTimeValue of(DateTime dateTime) {
62+
return new DateTimeValue(dateTime);
63+
}
64+
6165
public static Builder builder(DateTime dateTime) {
6266
return new Builder().set(dateTime);
6367
}

trunk/src/main/java/com/google/gcloud/datastore/DoubleValue.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ public Builder toBuilder() {
5757
return new Builder().mergeFrom(this);
5858
}
5959

60+
public static DoubleValue of(double value) {
61+
return new DoubleValue(value);
62+
}
63+
6064
public static Builder builder(double value) {
6165
return new Builder().set(value);
6266
}

trunk/src/main/java/com/google/gcloud/datastore/EntityValue.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ public Builder toBuilder() {
6666
return new Builder().mergeFrom(this);
6767
}
6868

69+
public static EntityValue of(PartialEntity entity) {
70+
return new EntityValue(entity);
71+
}
72+
6973
public static Builder builder(PartialEntity entity) {
7074
return new Builder().set(entity).indexed(false);
7175
}

trunk/src/main/java/com/google/gcloud/datastore/KeyValue.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ public Builder toBuilder() {
5757
return new Builder().mergeFrom(this);
5858
}
5959

60+
public static KeyValue of(Key key) {
61+
return new KeyValue(key);
62+
}
63+
6064
public static Builder builder(Key key) {
6165
return new Builder().set(key);
6266
}

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,14 @@ public Builder toBuilder() {
116116
return new Builder().mergeFrom(this);
117117
}
118118

119+
public static ListValue of(List<? extends Value<?>> values) {
120+
return new ListValue(values);
121+
}
122+
123+
public static ListValue of(Value<?> first, Value<?>... other) {
124+
return new ListValue(first, other);
125+
}
126+
119127
public static Builder builder() {
120128
return new Builder();
121129
}

trunk/src/main/java/com/google/gcloud/datastore/LongValue.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ public Builder toBuilder() {
5757
return new Builder().mergeFrom(this);
5858
}
5959

60+
public static LongValue of(long value) {
61+
return new LongValue(value);
62+
}
63+
6064
public static Builder builder(long value) {
6165
return new Builder().set(value);
6266
}

0 commit comments

Comments
 (0)