Skip to content

PropertyPath.from doesn't appear to support trailing digits in a chain component #2472

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

Closed
Ravynne opened this issue Oct 5, 2021 · 0 comments
Assignees
Labels
type: bug A general bug

Comments

@Ravynne
Copy link

Ravynne commented Oct 5, 2021

We were using class based projections and had a variable named vendorContactName and vendorContactEmail1 with paths vendorContact.name and vendorContact.email1 respectively. The latter would not work until I switched to an interface based projection and used @Value annotation so that I could preserve the dot notation. Now that the workaround is out of the way, how about an improvement to PropertyPath.from, so we could continue to use class based projections should we want to (without renaming our variable to emailOne, emailTwo, etc?

I think all that is needed is a RegEx change in the create method (of 4 parameters):

From
Pattern pattern = Pattern.compile("\\p{Lu}\\p{Ll}*$");
To
Pattern pattern = Pattern.compile("\\p{Lu}[\\p{Ll}\\d]*$");

This would allow the code to handle the trailing digits (by considering them lower-cased letters?) and actually try alternatives.
I'm not certain if digits should also be considered for upper-cased letters either. I know, digits and camel case are not good friends. But perhaps there's something for the case of, addressLine1, addressLine2, addressLine3.

Thanks for your time.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Oct 5, 2021
@schauder schauder added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Oct 18, 2021
@mp911de mp911de added this to the 2.4.15 (2020.0.15) milestone Oct 19, 2021
mp911de added a commit that referenced this issue Oct 19, 2021
PropertyPath now considers nested property paths (userLastname2 -> user.lastname2) that contain or end with a number.

Closes #2472
mp911de added a commit that referenced this issue Oct 19, 2021
Reduce test element visibility, remove unused constant.

See #2472
mp911de added a commit that referenced this issue Oct 19, 2021
Reduce test element visibility, remove unused constant.

See #2472
mp911de added a commit that referenced this issue Oct 19, 2021
PropertyPath now considers nested property paths (userLastname2 -> user.lastname2) that contain or end with a number.

Closes #2472
mp911de added a commit that referenced this issue Oct 19, 2021
Reduce test element visibility, remove unused constant.

See #2472
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

4 participants