Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion templates-v7/libraries/jersey3/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public class {{classname}} extends Service {
if ({{{paramName}}} == null) {
throw new IllegalArgumentException("Please provide the {{{paramName}}} path parameter");
}
pathParams.put("{{baseName}}", {{{paramName}}});
pathParams.put("{{baseName}}", {{{paramName}}}{{^isString}}.toString(){{/isString}});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

If a path parameter is a primitive type (such as int, long, or boolean), calling .toString() directly on it will cause a compilation error in Java because primitive types do not have methods. Using String.valueOf() is a safer and more robust approach because it handles both primitive types and object types (like enums or custom classes) seamlessly.

        pathParams.put("{{baseName}}", {{#isString}}{{{paramName}}}{{/isString}}{{^isString}}String.valueOf({{{paramName}}}){{/isString}});

{{/pathParams}}

{{/hasPathParams}}
Expand Down
Loading