From ad32b5f50bede5c56bdaf6c8c79508ab44130c70 Mon Sep 17 00:00:00 2001 From: Stephanie Wang Date: Fri, 18 Sep 2020 12:49:32 -0400 Subject: [PATCH] docs(samples): add protobuf.util dependency to enable FieldMaskUtil (#349) * docs(samples): add protobuf.util dependency to enable FieldMaskUtil * revert back samples module --- samples/install-without-bom/pom.xml | 6 ++++++ samples/snapshot/pom.xml | 6 ++++++ samples/snippets/pom.xml | 5 +++++ .../example/bigquerydatatransfer/UpdateTransferConfig.java | 3 ++- 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index df097e24..d36cf346 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -33,6 +33,12 @@ + + com.google.protobuf + protobuf-java-util + 3.13.0 + + junit junit diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 0c4d233d..c297314f 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -32,6 +32,12 @@ + + com.google.protobuf + protobuf-java-util + 3.13.0 + + junit junit diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml index 63e9f308..e37ab9ee 100644 --- a/samples/snippets/pom.xml +++ b/samples/snippets/pom.xml @@ -44,6 +44,11 @@ + + com.google.protobuf + protobuf-java-util + + junit diff --git a/samples/snippets/src/main/java/com/example/bigquerydatatransfer/UpdateTransferConfig.java b/samples/snippets/src/main/java/com/example/bigquerydatatransfer/UpdateTransferConfig.java index a75dff20..7d45ed69 100644 --- a/samples/snippets/src/main/java/com/example/bigquerydatatransfer/UpdateTransferConfig.java +++ b/samples/snippets/src/main/java/com/example/bigquerydatatransfer/UpdateTransferConfig.java @@ -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. @@ -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)