Skip to content
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

fix(java): apply Mouaad suggestions APIC-396 #344

Merged
merged 2 commits into from
Apr 7, 2022
Merged

Conversation

millotp
Copy link
Collaborator

@millotp millotp commented Apr 6, 2022

🧭 What and Why

🎟 JIRA Ticket: APIC-396

Apply the suggestions brought by @aallam in this PR

Changes included:

  • Use SNAKE_CASE for enum
  • Don't use java.util.Date
  • Add final keyword when needed
  • Expose correct api
  • Removed duplicate setter

🧪 Test

CI

@millotp millotp requested a review from a team April 6, 2022 15:50
@millotp millotp self-assigned this Apr 6, 2022
@millotp millotp requested review from eunjae-lee and shortcuts and removed request for a team April 6, 2022 15:50
@netlify
Copy link

netlify bot commented Apr 6, 2022

Deploy Preview for api-clients-automation canceled.

Name Link
🔨 Latest commit 6de8a05
🔍 Latest deploy log https://app.netlify.com/sites/api-clients-automation/deploys/624ea48eccbf684ba036cbd5

@algolia-bot
Copy link
Collaborator

algolia-bot commented Apr 6, 2022

✗ The generated branch has been deleted.

If the PR has been merged, you can check the generated code on the generated/main branch.

Copy link
Member

@shortcuts shortcuts left a comment

Choose a reason for hiding this comment

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

Love it, great clean! Small suggestion

Comment on lines 239 to 242
return value
.replaceAll("\\W+", "_")
.replaceAll("(\\b[a-z]+|\\G(?!^))((?:[A-Z]|\\d+)[a-z]*)", "$1_$2")
.toUpperCase(Locale.ROOT);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
return value
.replaceAll("\\W+", "_")
.replaceAll("(\\b[a-z]+|\\G(?!^))((?:[A-Z]|\\d+)[a-z]*)", "$1_$2")
.toUpperCase(Locale.ROOT);
return value
.replaceAll("(.+?)([A-Z]|[0-9])", "$1_$2")
.toUpperCase(Locale.ROOT);

Not fully tested but I think it should work

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Your regex works even better, it handles the case like AddUnique -> ADD_UNIQUE that didn't work before, thanks !

Copy link
Member

Choose a reason for hiding this comment

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

<3

@millotp millotp enabled auto-merge (squash) April 7, 2022 08:41
Copy link
Member

@shortcuts shortcuts left a comment

Choose a reason for hiding this comment

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

🧹 nice

also thanks @aallam

@millotp millotp merged commit 34ad2c1 into main Apr 7, 2022
@millotp millotp deleted the fix/java-suggestions branch April 7, 2022 08:53
algolia-bot added a commit to algolia/algoliasearch-client-java that referenced this pull request Apr 7, 2022
algolia/api-clients-automation#344

Co-authored-by: Pierre Millot <pierre.millot@algolia.com>
shortcuts pushed a commit that referenced this pull request Apr 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants