@@ -57,7 +57,7 @@ public TableFieldSchema apply(Field field) {
5757 private final String name ;
5858 private final LegacySQLTypeName type ;
5959 private final FieldList subFields ;
60- private final String mode ;
60+ private final Mode mode ;
6161 private final String description ;
6262 private final PolicyTags policyTags ;
6363 private final Long maxLength ;
@@ -84,7 +84,7 @@ public static final class Builder {
8484 private String name ;
8585 private LegacySQLTypeName type ;
8686 private FieldList subFields ;
87- private String mode ;
87+ private Mode mode ;
8888 private String description ;
8989 private PolicyTags policyTags ;
9090 private Long maxLength ;
@@ -205,7 +205,7 @@ public Builder setType(StandardSQLTypeName type, FieldList subFields) {
205205
206206 /** Sets the mode of the field. When not specified {@link Mode#NULLABLE} is used. */
207207 public Builder setMode (Mode mode ) {
208- this .mode = mode != null ? mode . name () : null ;
208+ this .mode = mode ;
209209 return this ;
210210 }
211211
@@ -357,7 +357,7 @@ public LegacySQLTypeName getType() {
357357
358358 /** Returns the field mode. By default {@link Mode#NULLABLE} is used. */
359359 public Mode getMode () {
360- return mode != null ? Mode . valueOf ( mode ) : null ;
360+ return mode ;
361361 }
362362
363363 /** Returns the field description. */
@@ -509,7 +509,7 @@ TableFieldSchema toPb() {
509509 fieldSchemaPb .setName (name );
510510 fieldSchemaPb .setType (type .name ());
511511 if (mode != null ) {
512- fieldSchemaPb .setMode (mode );
512+ fieldSchemaPb .setMode (mode . name () );
513513 }
514514 if (description != null ) {
515515 fieldSchemaPb .setDescription (description );
0 commit comments