@@ -199,7 +199,7 @@ public Dataset call() {
199199 }
200200
201201 @ Override
202- public BaseTableInfo create (BaseTableInfo table , TableOption ... options )
202+ public < T extends BaseTableInfo > T create (T table , TableOption ... options )
203203 throws BigQueryException {
204204 final Table tablePb = setProjectId (table ).toPb ();
205205 final Map <BigQueryRpc .Option , ?> optionsMap = optionMap (options );
@@ -216,7 +216,7 @@ public Table call() {
216216 }
217217
218218 @ Override
219- public JobInfo create (JobInfo job , JobOption ... options ) throws BigQueryException {
219+ public < T extends JobInfo > T create (T job , JobOption ... options ) throws BigQueryException {
220220 final Job jobPb = setProjectId (job ).toPb ();
221221 final Map <BigQueryRpc .Option , ?> optionsMap = optionMap (options );
222222 try {
@@ -335,7 +335,7 @@ public Dataset call() {
335335 }
336336
337337 @ Override
338- public BaseTableInfo update (BaseTableInfo table , TableOption ... options )
338+ public < T extends BaseTableInfo > T update (T table , TableOption ... options )
339339 throws BigQueryException {
340340 final Table tablePb = setProjectId (table ).toPb ();
341341 final Map <BigQueryRpc .Option , ?> optionsMap = optionMap (options );
@@ -352,13 +352,13 @@ public Table call() {
352352 }
353353
354354 @ Override
355- public BaseTableInfo getTable (final String datasetId , final String tableId ,
355+ public < T extends BaseTableInfo > T getTable (final String datasetId , final String tableId ,
356356 TableOption ... options ) throws BigQueryException {
357357 return getTable (TableId .of (datasetId , tableId ), options );
358358 }
359359
360360 @ Override
361- public BaseTableInfo getTable (final TableId tableId , TableOption ... options )
361+ public < T extends BaseTableInfo > T getTable (final TableId tableId , TableOption ... options )
362362 throws BigQueryException {
363363 final Map <BigQueryRpc .Option , ?> optionsMap = optionMap (options );
364364 try {
@@ -368,7 +368,7 @@ public Table call() {
368368 return bigQueryRpc .getTable (tableId .dataset (), tableId .table (), optionsMap );
369369 }
370370 }, options ().retryParams (), EXCEPTION_HANDLER );
371- return answer == null ? null : BaseTableInfo .fromPb (answer );
371+ return answer == null ? null : BaseTableInfo .< T > fromPb (answer );
372372 } catch (RetryHelper .RetryHelperException e ) {
373373 throw BigQueryException .translateAndThrow (e );
374374 }
@@ -466,12 +466,13 @@ public List<FieldValue> apply(TableRow rowPb) {
466466 }
467467
468468 @ Override
469- public JobInfo getJob (String jobId , JobOption ... options ) throws BigQueryException {
469+ public < T extends JobInfo > T getJob (String jobId , JobOption ... options ) throws BigQueryException {
470470 return getJob (JobId .of (jobId ), options );
471471 }
472472
473473 @ Override
474- public JobInfo getJob (final JobId jobId , JobOption ... options ) throws BigQueryException {
474+ public <T extends JobInfo > T getJob (final JobId jobId , JobOption ... options )
475+ throws BigQueryException {
475476 final Map <BigQueryRpc .Option , ?> optionsMap = optionMap (options );
476477 try {
477478 Job answer = runWithRetries (new Callable <Job >() {
@@ -480,7 +481,7 @@ public Job call() {
480481 return bigQueryRpc .getJob (jobId .job (), optionsMap );
481482 }
482483 }, options ().retryParams (), EXCEPTION_HANDLER );
483- return answer == null ? null : JobInfo .fromPb (answer );
484+ return answer == null ? null : JobInfo .< T > fromPb (answer );
484485 } catch (RetryHelper .RetryHelperException e ) {
485486 throw BigQueryException .translateAndThrow (e );
486487 }
0 commit comments