@@ -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