Skip to content

Commit f6937a9

Browse files
committed
---
yaml --- r: 1375 b: refs/heads/master c: 338ede1 h: refs/heads/master i: 1373: f7f7ef3 1371: 31a5814 1367: ca1a863 1359: 738bb1c 1343: fe360ed
1 parent c86b450 commit f6937a9

3 files changed

Lines changed: 8 additions & 8 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: ae2a484006337782084ee62096a6b7114051d836
2+
refs/heads/master: 338ede110628da0e980bcae8c7ec499b89c12dc1
33
refs/heads/travis: e21ee7b88a5edc3f3d8c71f90c3fc32abf7e8dd6
44
refs/heads/gh-pages: d1b373c30c176edc08692348167bec3a244bb823
55
refs/heads/bigquery: 762fa5830e6c398c0396177e3e7fd243bd62cfc3

trunk/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/ExternalDataConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ com.google.api.services.bigquery.model.ExternalDataConfiguration toPb() {
283283
if (sourceUris != null) {
284284
externalConfigurationPb.setSourceUris(sourceUris);
285285
}
286-
if (formatOptions instanceof CsvOptions) {
286+
if (formatOptions != null && FormatOptions.CSV.equals(formatOptions.type())) {
287287
externalConfigurationPb.setCsvOptions(((CsvOptions) formatOptions).toPb());
288288
}
289289
return externalConfigurationPb;

trunk/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/Field.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,19 +182,19 @@ public boolean equals(Object obj) {
182182
* than one value.
183183
*/
184184
public enum Mode {
185-
NULLABLE, REQUIRED, REPEATED, NOT_SET
185+
NULLABLE, REQUIRED, REPEATED
186186
}
187187

188188
private final String name;
189189
private final Type type;
190-
private final Mode mode;
190+
private final String mode;
191191
private final String description;
192192

193193
public static final class Builder {
194194

195195
private String name;
196196
private Type type;
197-
private Mode mode;
197+
private String mode;
198198
private String description;
199199

200200
private Builder() {}
@@ -231,7 +231,7 @@ public Builder type(Type type) {
231231
* Sets the mode of the field. When not specified {@link Mode#NULLABLE} is used.
232232
*/
233233
public Builder mode(Mode mode) {
234-
this.mode = firstNonNull(mode, Mode.NOT_SET);
234+
this.mode = mode != null ? mode.name() : Data.<String>nullOf(String.class);
235235
return this;
236236
}
237237

@@ -279,7 +279,7 @@ public Type type() {
279279
* Returns the field mode. By default {@link Mode#NULLABLE} is used.
280280
*/
281281
public Mode mode() {
282-
return mode == Mode.NOT_SET ? null : mode;
282+
return mode != null ? Mode.valueOf(mode) : null;
283283
}
284284

285285
/**
@@ -329,7 +329,7 @@ TableFieldSchema toPb() {
329329
fieldSchemaPb.setName(name);
330330
fieldSchemaPb.setType(type.value().name());
331331
if (mode != null) {
332-
fieldSchemaPb.setMode(mode == Mode.NOT_SET ? Data.<String>nullOf(String.class) : mode.name());
332+
fieldSchemaPb.setMode(mode);
333333
}
334334
if (description != null) {
335335
fieldSchemaPb.setDescription(description);

0 commit comments

Comments
 (0)