Repository navigation
[Java][WebClient][RestClient] Add toString to single-request-parameter class #24568
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -52,6 +52,25 @@ | |||||
| return Objects.hash({{#allParams}}{{#vendorExtensions.x-is-jackson-optional-nullable}}hashCodeNullable({{paramName}}){{/vendorExtensions.x-is-jackson-optional-nullable}}{{^vendorExtensions.x-is-jackson-optional-nullable}}{{^isByteArray}}{{paramName}}{{/isByteArray}}{{#isByteArray}}Arrays.hashCode({{paramName}}){{/isByteArray}}{{/vendorExtensions.x-is-jackson-optional-nullable}}{{^-last}}, {{/-last}}{{/allParams}}); | ||||||
| {{/useReflectionEqualsHashCode}} | ||||||
| } | ||||||
|
|
||||||
| @Override | ||||||
| public String toString() { | ||||||
| StringBuilder sb = new StringBuilder(); | ||||||
| sb.append("class {{#lambda.titlecase}}{{operationId}}{{/lambda.titlecase}}Request {\n"); | ||||||
| {{#allParams}} | ||||||
| sb.append(" {{paramName}}: ").append({{#isPassword}}"*"{{/isPassword}}{{^isPassword}}toIndentedString({{paramName}}){{/isPassword}}).append("\n"); | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Binary request parameters will produce identity-based values such as Prompt for AI agents
Suggested change
|
||||||
| {{/allParams}} | ||||||
| sb.append("}"); | ||||||
| return sb.toString(); | ||||||
| } | ||||||
|
|
||||||
| /** | ||||||
| * Convert the given object to string with each line indented by 4 spaces | ||||||
| * (except the first line). | ||||||
| */ | ||||||
| private{{#jsonb}} static{{/jsonb}} String toIndentedString(Object o) { | ||||||
| return o == null ? "null" : o.toString().replace("\n", "\n "); | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| /** | ||||||
|
|
||||||
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.
P2: A request parameter named
sbis rendered incorrectly: the unqualified field reference resolves to the localStringBuilder sb, sotoString()prints the builder instead of the parameter value. Qualifying generated fields withthis.avoids this valid name collision.Prompt for AI agents