Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

docs(samples): add protobuf.util dependency to enable FieldMaskUtil #349

Merged
merged 2 commits into from Sep 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions samples/install-without-bom/pom.xml
Expand Up @@ -33,6 +33,12 @@
</dependency>
<!-- [END bigquerydatatransfer_install_without_bom] -->

<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java-util</artifactId>
<version>3.13.0</version>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions samples/snapshot/pom.xml
Expand Up @@ -32,6 +32,12 @@
</dependency>
<!-- {x-version-update-end} -->

<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java-util</artifactId>
<version>3.13.0</version>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
5 changes: 5 additions & 0 deletions samples/snippets/pom.xml
Expand Up @@ -44,6 +44,11 @@
</dependency>
<!-- [END bigquerydatatransfer_install_with_bom] -->

<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java-util</artifactId>
</dependency>

<!-- Test dependencies -->
<dependency>
<groupId>junit</groupId>
Expand Down
Expand Up @@ -22,6 +22,7 @@
import com.google.cloud.bigquery.datatransfer.v1.TransferConfig;
import com.google.cloud.bigquery.datatransfer.v1.UpdateTransferConfigRequest;
import com.google.protobuf.FieldMask;
import com.google.protobuf.util.FieldMaskUtil;
import java.io.IOException;

// Sample to update transfer config.
Expand All @@ -40,7 +41,7 @@ public static void updateTransferConfig(String configId) throws IOException {
.setName(configId)
.setDisplayName("UPDATED_DISPLAY_NAME")
.build();
FieldMask updateMask = FieldMask.newBuilder().addPaths("display_name").build();
FieldMask updateMask = FieldMaskUtil.fromString("display_name");
UpdateTransferConfigRequest request =
UpdateTransferConfigRequest.newBuilder()
.setTransferConfig(transferConfig)
Expand Down