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

Fallback to StringUtils.uncapitalize(…) when looking up property paths #2940

Closed
wants to merge 4 commits into from

Conversation

mp911de
Copy link
Member

@mp911de mp911de commented Sep 22, 2023

Naming restrictions for property paths used in query method names require capitalization of the first letter regardless whether the property name uses a second-letter uppercase form (zIndex -> ZIndex, qCode -> QCode). In such cases, Introspector.decapitalize(…) shortcuts to non-decapitalization as it checks the second letter casing.

This leads to the case that the property name cannot be resolved, assuming proper property naming (getzIndex(), zIndex()).

Falling back to StringUtils.uncapitalize() allows catching such properties.

Closes #1851

@mp911de mp911de requested a review from odrotbohm September 22, 2023 07:38
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Sep 22, 2023
@mp911de mp911de changed the title Fallback to StringUtils.decapitalize(…) when looking up property paths Fallback to StringUtils.uncapitalize(…) when looking up property paths Sep 25, 2023
@christophstrobl
Copy link
Member

christophstrobl commented Nov 8, 2023

I think we should also update the repositories.query-methods.query-property-expressions section in the reference documentation. It's quite minimalistic when it comes to the actual resolution and what users can/should expect.

mp911de and others added 4 commits November 20, 2023 12:19
Naming restrictions for property paths used in query method names requite capitalization of the first letter regardless whether the property name uses a second-letter uppercase form (zIndex -> ZIndex, qCode -> QCode). In such cases, Introspector.decapitalize(…) shortcuts to non-decapitalization as it checks the second letter casing.

This leads to the case that the property name cannot be resolved, assuming proper property naming (getzIndex(), zIndex()).

Falling back to StringUtils.uncapitalize() allows catching such properties.
Fix test naming. Improve equals check by caching resolved generics.
christophstrobl pushed a commit that referenced this pull request Nov 21, 2023
Naming restrictions for property paths used in query method names requite capitalization of the first letter regardless whether the property name uses a second-letter uppercase form (zIndex -> ZIndex, qCode -> QCode). In such cases, Introspector.decapitalize(…) shortcuts to non-decapitalization as it checks the second letter casing.

This leads to the case that the property name cannot be resolved, assuming proper property naming (getzIndex(), zIndex()).

Falling back to StringUtils.uncapitalize() allows catching such properties.

Closes: #1851
Original Pull Request: #2940
christophstrobl pushed a commit that referenced this pull request Nov 21, 2023
Fix naming.

Original Pull Request: #2940
christophstrobl added a commit that referenced this pull request Nov 21, 2023
@christophstrobl christophstrobl deleted the issue/1851 branch November 21, 2023 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
4 participants