Skip to content

Commit 6231ec8

Browse files
authored
---
yaml --- r: 9001 b: refs/heads/lesv-patch-1 c: ce6ef37 h: refs/heads/master i: 8999: 6238f58
1 parent 165a917 commit 6231ec8

3 files changed

Lines changed: 38 additions & 6 deletions

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ refs/tags/v0.22.0: 18b298fe4bfe8ec2f20b0e0bf7ffdcce5cc3c5fe
6666
refs/heads/vam-google-patch-1: d0c8fee3a4074d0bf7360ce8c4f7f7223d0ee7b9
6767
refs/heads/vam-google-patch-CODEOWNERS: 2ac1616e25229e51d08a984708ef1918f91a35ee
6868
refs/heads/danoscarmike-patch-1: 7342a9916bce4ed00002c7202e2a16c5d46afaea
69-
refs/heads/lesv-patch-1: e2f0d20a82e963df7e9a788cd8c26b48b917af61
69+
refs/heads/lesv-patch-1: ce6ef37c7811e96aaf97777a71e37ed321e10d1a
7070
refs/heads/ml-update-branch: 079dd6610017f5c51b9d1938c12d6d55b61513cf
7171
refs/heads/vkedia-patch-2: 7d8241388a9769a5c069334761b06c7012c878e7
7272
refs/heads/vkedia-patch-3: 4d128043acaa7db9160faf439d2ca6104e8a88cb

branches/lesv-patch-1/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValue.java

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
import static com.google.common.base.Preconditions.checkState;
2121

2222
import com.google.api.client.util.Data;
23+
import com.google.api.core.BetaApi;
2324
import com.google.common.base.MoreObjects;
2425
import com.google.common.io.BaseEncoding;
25-
2626
import java.io.Serializable;
2727
import java.util.List;
2828
import java.util.Map;
@@ -65,7 +65,7 @@ public enum Attribute {
6565
}
6666

6767
private FieldValue(Attribute attribute, Object value) {
68-
this.attribute = attribute;
68+
this.attribute = checkNotNull(attribute);
6969
this.value = value;
7070
}
7171

@@ -251,7 +251,22 @@ public final boolean equals(Object obj) {
251251
return attribute == other.attribute && Objects.equals(value, other.value);
252252
}
253253

254-
static FieldValue of(Attribute attribute, Object value) {
254+
/**
255+
* Creates an instance of {@code FieldValue}, useful for testing.
256+
*
257+
* <p>If the {@code attribute} is {@link Attribute#PRIMITIVE}, the {@code value} should be the
258+
* string representation of the underlying value, eg {@code "123"} for number {@code 123}.
259+
*
260+
* <p>If the {@code attribute} is {@link Attribute#REPEATED} or {@link Attribute#RECORD}, the
261+
* {@code value} should be {@code List} of {@link FieldValue}s or {@link FieldValueList},
262+
* respectively.
263+
*
264+
* <p>This method is unstable. See <a
265+
* href="https://github.com/GoogleCloudPlatform/google-cloud-java/pull/2891">this discussion</a>
266+
* for more context.
267+
*/
268+
@BetaApi
269+
public static FieldValue of(Attribute attribute, Object value) {
255270
return new FieldValue(attribute, value);
256271
}
257272

branches/lesv-patch-1/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValueList.java

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package com.google.cloud.bigquery;
1818

19+
import com.google.api.core.BetaApi;
1920
import com.google.common.collect.ImmutableList;
2021
import java.io.Serializable;
2122
import java.util.AbstractList;
@@ -84,11 +85,27 @@ public int size() {
8485
return row.size();
8586
}
8687

87-
static FieldValueList of(List<FieldValue> row, FieldList schema) {
88+
/**
89+
* Creates an instance of {@code FieldValueList}, useful for testing.
90+
*
91+
* <p>This method is unstable. See <a
92+
* href="https://github.com/GoogleCloudPlatform/google-cloud-java/pull/2891">this discussion</a>
93+
* for more context.
94+
*/
95+
@BetaApi
96+
public static FieldValueList of(List<FieldValue> row, FieldList schema) {
8897
return new FieldValueList(row, schema);
8998
}
9099

91-
static FieldValueList of(List<FieldValue> row, Field... schema) {
100+
/**
101+
* Creates an instance of {@code FieldValueList}, useful for testing.
102+
*
103+
* <p>This method is unstable. See <a
104+
* href="https://github.com/GoogleCloudPlatform/google-cloud-java/pull/2891">this discussion</a>
105+
* for more context.
106+
*/
107+
@BetaApi
108+
public static FieldValueList of(List<FieldValue> row, Field... schema) {
92109
return of(row, schema.length > 0 ? FieldList.of(schema) : null);
93110
}
94111

0 commit comments

Comments
 (0)