fix: update BigQuerySchemaUtil to use non-deprecated hasExtension (#2… · googleapis/java-bigquerystorage@b97b234

File tree

1 file changed

lines changed

  • google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1

1 file changed

lines changed

Original file line numberDiff line numberDiff line change

@@ -15,7 +15,9 @@

1515

*/

1616

package com.google.cloud.bigquery.storage.v1;

1717
18+

import com.google.protobuf.DescriptorProtos.FieldOptions;

1819

import com.google.protobuf.Descriptors.FieldDescriptor;

20+

import com.google.protobuf.ExtensionLite;

1921

import java.nio.charset.StandardCharsets;

2022

import java.util.Base64;

2123

@@ -74,8 +76,12 @@ public static String generatePlaceholderFieldName(String fieldName) {

7476

* @return columnName annotation if present, otherwise return the field name.

7577

*/

7678

public static String getFieldName(FieldDescriptor fieldDescriptor) {

77-

return fieldDescriptor.getOptions().hasExtension(AnnotationsProto.columnName)

78-

? fieldDescriptor.getOptions().getExtension(AnnotationsProto.columnName)

79+

return fieldDescriptor

80+

.getOptions()

81+

.hasExtension((ExtensionLite<FieldOptions, String>) AnnotationsProto.columnName)

82+

? fieldDescriptor

83+

.getOptions()

84+

.getExtension((ExtensionLite<FieldOptions, String>) AnnotationsProto.columnName)

7985

: fieldDescriptor.getName();

8086

}

8187

}