GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [DO NOT REVIEW][Merged In #573][CloseSoon]Use resource name class to construct String Default value by summer-ji-eng · Pull Request #577 · googleapis/sdk-platform-java

This repository was archived by the owner on Oct 29, 2026. It is now read-only.

Conversation

@summer-ji-eng

@summer-ji-eng summer-ji-eng commented Dec 1, 2020

Copy link
Copy Markdown
Contributor

Default value on a string-type method argument of resource name is constructed by resources name class.
Use

   * try (ConfigClient configClient = ConfigClient.create()) {
   *   LogSinkName sinkName = LogSinkName.ofProjectSinkName("[PROJECT]", "[SINK]");
   *   configClient.deleteSink(sinkName.toString());
   * }

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
summer-ji-eng added 4 commits November 25, 2020 13:32
@summer-ji-eng
Add resource name into ClassComposer interface
3541a47
@summer-ji-eng
Remove resource name from class composer interface
7719fbe
@summer-ji-eng
Implement Pure Unary RPC sample code
749b0d2
@summer-ji-eng
Use resource name class to construct String Default value
1b78939
@summer-ji-eng
summer-ji-eng requested review from miraleung and xiaozhenliu-gg5 as code owners December 1, 2020 03:47
@google-cla google-cla Bot added the cla: yes This human has signed the Contributor License Agreement. label Dec 1, 2020
summer-ji-eng added 2 commits November 30, 2020 20:04
@summer-ji-eng
remove the unused params
5035102
@summer-ji-eng
fix multiple words naming
3696493
miraleung
miraleung suggested changes Dec 2, 2020
View reviewed changes
Comment thread src/main/java/com/google/api/generator/gapic/composer/DefaultValueComposer.java
}

if (f.type().equals(TypeNode.STRING)) {
if (useSampleCode

@miraleung miraleung Dec 2, 2020

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not pass in the ResourceName-typed field instead if the field is a String? Then we don't need to change DefaultValueComposer at all.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/main/java/com/google/api/generator/gapic/composer/MethodSampleCodeHelperComposer.java Outdated
DefaultValueComposer.createDefaultValue(arg, resourceNames)))
arg -> {
Expr defaultValueExpr =
DefaultValueComposer.createDefaultValue(arg, resourceNames, true);

@miraleung miraleung Dec 2, 2020

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here: If arg is String-typed and it has a matching resource name, pass that arg in instead.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/main/java/com/google/api/generator/gapic/composer/DefaultValueComposer.java
}

static Expr createDefaultValue(
Field f, Map<String, ResourceName> resourceNames, Boolean useSampleCode) {

@miraleung miraleung Dec 2, 2020

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was the motivation for using the boxed type?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/main/java/com/google/api/generator/gapic/composer/MethodSampleCodeHelperComposer.java
arguments.stream()
.map(arg -> methodArgVarExprMap.get(arg.name()))
.collect(Collectors.toList());
createMethodArgVarExprs(arguments, methodArgVarExprMap, resourceNames);

@miraleung miraleung Dec 2, 2020

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PTAL at my comments on splitting out the VarExprs in #573.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@summer-ji-eng

summer-ji-eng commented Dec 2, 2020

Copy link
Copy Markdown
Contributor Author

Thanks for valuable comments. Make sense to me. Instead of pass boolean value into DefaultValueComposer, I will use your advice and merged in #573 .

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@summer-ji-eng summer-ji-eng changed the title [fix]Use resource name class to construct String Default value [Merged In #573][CloseSoon]Use resource name class to construct String Default value Dec 2, 2020
@summer-ji-eng summer-ji-eng changed the title [Merged In #573][CloseSoon]Use resource name class to construct String Default value [DO NOT REVIEW][Merged In #573][CloseSoon]Use resource name class to construct String Default value Dec 2, 2020
@summer-ji-eng
no use boolean for default value
53bcc49
@summer-ji-eng
summer-ji-eng force-pushed the pure_unary_rpc_1 branch from 84ed106 to d484780 Compare December 3, 2020 01:35
@summer-ji-eng

summer-ji-eng commented Dec 3, 2020

Copy link
Copy Markdown
Contributor Author

Merge this PR into #573

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@summer-ji-eng summer-ji-eng closed this Dec 3, 2020
@summer-ji-eng
summer-ji-eng deleted the string_default_value_1.1 branch January 19, 2021 23:18
suztomo pushed a commit that referenced this pull request Mar 21, 2023
@renovate-bot
build(deps): update dependency com.google.cloud:google-cloud-shared-c…
cb1752f
…onfig to v1.2.6 (#577)
suztomo pushed a commit that referenced this pull request Mar 21, 2023
@renovate-bot
deps: update dependency com.google.guava:guava-bom to v31 (#577)
a72fd39
suztomo pushed a commit that referenced this pull request Mar 21, 2023
@release-please
chore: release 2.1.8 (#582)
a311e92
🤖 I have created a release \*beep\* \*boop\*
---
### [2.1.8](https://www.github.com/googleapis/java-core/compare/v2.1.7...v2.1.8) (2021-10-15)


### Dependencies

* update dependency com.google.api-client:google-api-client-bom to v1.32.2 ([#593](https://www.github.com/googleapis/java-core/issues/593)) ([5471efd](https://www.github.com/googleapis/java-core/commit/5471efda5271fc21df2ace74d4aa59dfff610a53))
* update dependency com.google.api:api-common to v2.0.4 ([#585](https://www.github.com/googleapis/java-core/issues/585)) ([3063023](https://www.github.com/googleapis/java-core/commit/3063023e34e10deef2a65d82a39a36d03296f145))
* update dependency com.google.api:api-common to v2.0.5 ([#589](https://www.github.com/googleapis/java-core/issues/589)) ([354ff97](https://www.github.com/googleapis/java-core/commit/354ff97f777f7b151744fc542bb43cb9caa3ba4a))
* update dependency com.google.api:gax-bom to v2.6.0 ([#594](https://www.github.com/googleapis/java-core/issues/594)) ([123ebcc](https://www.github.com/googleapis/java-core/commit/123ebcc927585ff42e4b6cdbde26deb527b45621))
* update dependency com.google.api.grpc:proto-google-common-protos to v2.6.0 ([#578](https://www.github.com/googleapis/java-core/issues/578)) ([cfd5d51](https://www.github.com/googleapis/java-core/commit/cfd5d51c5e82690a2eac536fbd75e3c789c52e36))
* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.1.3 ([#574](https://www.github.com/googleapis/java-core/issues/574)) ([92c2a59](https://www.github.com/googleapis/java-core/commit/92c2a599d916d0103ad152c380c1f4c1a8bcfd81))
* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.1.4 ([#584](https://www.github.com/googleapis/java-core/issues/584)) ([6984a40](https://www.github.com/googleapis/java-core/commit/6984a407a1b8f3466d0d695465f988d9138c95f6))
* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.1.5 ([#587](https://www.github.com/googleapis/java-core/issues/587)) ([30e3d99](https://www.github.com/googleapis/java-core/commit/30e3d99f893da41af9ae3ac22356bed2bddc1fa8))
* update dependency com.google.api.grpc:proto-google-iam-v1 to v1.1.6 ([#590](https://www.github.com/googleapis/java-core/issues/590)) ([e7446c8](https://www.github.com/googleapis/java-core/commit/e7446c8475ee339abcf3f77bb993689501235014))
* update dependency com.google.auth:google-auth-library-bom to v1.2.0 ([#581](https://www.github.com/googleapis/java-core/issues/581)) ([3390141](https://www.github.com/googleapis/java-core/commit/3390141b28f90690956222c0d6661d502f91c706))
* update dependency com.google.auth:google-auth-library-bom to v1.2.1 ([#591](https://www.github.com/googleapis/java-core/issues/591)) ([7c4a658](https://www.github.com/googleapis/java-core/commit/7c4a6580faed1201d7e136d40f71a8805235e8ba))
* update dependency com.google.guava:guava-bom to v31 ([#577](https://www.github.com/googleapis/java-core/issues/577)) ([a72fd39](https://www.github.com/googleapis/java-core/commit/a72fd395d4eded744fb110dd01bac12906d7c564))
* update dependency com.google.http-client:google-http-client-bom to v1.40.1 ([#588](https://www.github.com/googleapis/java-core/issues/588)) ([a9402ff](https://www.github.com/googleapis/java-core/commit/a9402ff2d38eb220988550c04f2c27975ca9c6b9))
* update dependency com.google.protobuf:protobuf-bom to v3.18.1 ([#583](https://www.github.com/googleapis/java-core/issues/583)) ([6ccb52f](https://www.github.com/googleapis/java-core/commit/6ccb52f7386abbc2232178678523befc7e4b7e16))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

@xiaozhenliu-gg5 xiaozhenliu-gg5 Awaiting requested review from xiaozhenliu-gg5
1 more reviewer
@miraleung miraleung miraleung requested changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@summer-ji-eng @miraleung
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.