@@ -179,8 +179,8 @@ public String compression() {
179179 * Returns whether BigQuery should allow extra values that are not represented in the table
180180 * schema. If true, the extra values are ignored. If false, records with extra columns are treated
181181 * as bad records, and if there are too many bad records, an invalid error is returned in the job
182- * result. The default value is false. The value of {@link #format ()} determines what BigQuery
183- * treats as an extra value.
182+ * result. The default value is false. The value of {@link #formatOptions ()} determines what
183+ * BigQuery treats as an extra value.
184184 *
185185 * @see <a href="https://cloud.google.com/bigquery/docs/reference/v2/tables#externalDataConfiguration.ignoreUnknownValues">
186186 * Ignore Unknown Values</a>
@@ -204,16 +204,6 @@ public Schema schema() {
204204 return schema ;
205205 }
206206
207- /**
208- * Returns the source format of the external data.
209- *
210- * <a href="https://cloud.google.com/bigquery/docs/reference/v2/tables#externalDataConfiguration.sourceFormat">
211- * Source Format</a>
212- */
213- public String format () {
214- return formatOptions .type ();
215- }
216-
217207 /**
218208 * Returns the fully-qualified URIs that point to your data in Google Cloud Storage. Each URI can
219209 * contain one '*' wildcard character that must come after the bucket's name. Size limits
@@ -227,11 +217,12 @@ public List<String> sourceUris() {
227217 }
228218
229219 /**
230- * Returns additional properties used to parse CSV data (used when {@link #format()} is set to
231- * CSV). Returns {@code null} if not set .
220+ * Returns the source format, and possibly some parsing options, of the external data. Supported
221+ * formats are {@code CSV} and {@code NEWLINE_DELIMITED_JSON} .
232222 */
233- public CsvOptions csvOptions () {
234- return formatOptions instanceof CsvOptions ? (CsvOptions ) formatOptions : null ;
223+ @ SuppressWarnings ("unchecked" )
224+ public <F extends FormatOptions > F formatOptions () {
225+ return (F ) formatOptions ;
235226 }
236227
237228 /**
@@ -292,8 +283,8 @@ com.google.api.services.bigquery.model.ExternalDataConfiguration toPb() {
292283 if (sourceUris != null ) {
293284 externalConfigurationPb .setSourceUris (sourceUris );
294285 }
295- if (csvOptions () != null ) {
296- externalConfigurationPb .setCsvOptions (csvOptions ( ).toPb ());
286+ if (formatOptions instanceof CsvOptions ) {
287+ externalConfigurationPb .setCsvOptions ((( CsvOptions ) formatOptions ).toPb ());
297288 }
298289 return externalConfigurationPb ;
299290 }
0 commit comments