Skip to content

Commit de822bf

Browse files
authored
---
yaml --- r: 8715 b: refs/heads/master c: ce6ef37 h: refs/heads/master i: 8713: 88c4274 8711: db970b5
1 parent 11e78ed commit de822bf

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
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: e2f0d20a82e963df7e9a788cd8c26b48b917af61
2+
refs/heads/master: ce6ef37c7811e96aaf97777a71e37ed321e10d1a
33
refs/heads/travis: 47e4fee4fd5af9b2a8ce46f23c72ec95f9b195b2
44
refs/heads/gh-pages: 6daca92127d91b7c2c99490080ecf8a13fa94cde
55
refs/tags/0.0.9: 22f1839238f66c39e67ed4dfdcd273b1ae2e8444

trunk/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

trunk/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)