Skip to content

Conversation

@mjkhub
Copy link
Contributor

@mjkhub mjkhub commented May 26, 2025

Hey boss, I noticed a small part that could be cleaned up to better align with the builder pattern.

It’s not a big change, but I thought it might be helpful—please take a look when you have a chance.

Thanks 👍

@mjkhub mjkhub force-pushed the refactor-builder-pattern-VertexAiGeminiSafetySetting branch from 4533c0c to 0e1a536 Compare May 26, 2025 08:17
@mjkhub
Copy link
Contributor Author

mjkhub commented May 26, 2025

@ilayaperumalg

Boss, would really appreciate it if you could take a quick look at this PR 🫡

@mjkhub mjkhub force-pushed the refactor-builder-pattern-VertexAiGeminiSafetySetting branch from 84e6164 to 3f96019 Compare May 27, 2025 06:30
@mjkhub
Copy link
Contributor Author

mjkhub commented May 27, 2025

@ilayaperumalg

Boss, I’ve fixed the formatting issues using spring-javaformat:apply.

@ilayaperumalg ilayaperumalg self-assigned this May 27, 2025
@ilayaperumalg
Copy link
Member

@mjkhub Thanks for the PR using the builder!

this.category = HarmCategory.HARM_CATEGORY_UNSPECIFIED;
this.threshold = HarmBlockThreshold.HARM_BLOCK_THRESHOLD_UNSPECIFIED;
this.method = HarmBlockMethod.HARM_BLOCK_METHOD_UNSPECIFIED;
private VertexAiGeminiSafetySetting(Builder builder) {
Copy link
Member

Choose a reason for hiding this comment

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

Since we are changing the public accessor of this constructor to private, we need to deprecate this constructor by keeping this change. The deprecated method can further be removed right after 1.1.0 release.

Copy link
Member

Choose a reason for hiding this comment

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

The ctor should not accept a builder, the builder should be calling the private ctor that contains the full argument list

Copy link
Contributor Author

@mjkhub mjkhub May 30, 2025

Choose a reason for hiding this comment

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

I've updated the code to use the full-argument constructor as you mentioned 🫡

As for deprecating the public constructor, I tried to add the annotation, but since the new one has the exact same parameters, it's not actually possible to keep both.

@markpollack
Copy link
Member

Thanks for the fixes @mjkhub will be merging soon.

@ilayaperumalg
Copy link
Member

Rebased and merged as 49e5c63. Also, cherry-picked and pushed the changes into 1.0.x as 9068789

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants