Details
-
Improvement
-
Status: Closed
-
Trivial
-
Resolution: Fixed
-
1.1-rc-3
-
None
-
None
-
Patch
Description
groovy.util.ObjectGraphBuilder$DefaultRelationNameResolver currently pluralizes Strings by simply appending 's' to the end of the word. While this works under many scenarios, it breaks down under numerous more. See http://en.wikipedia.org/wiki/English_plural for what I assume is a comprehensive list of rules.
While I'm not proposing enhancing DefaultRelationNameResolver to support all of the English plural rules, there are some "low hanging fruit" rules that we can support fairly easily. One such rule is the -ies rule. Essentially, under most scenarios, words ending in 'y' preceded by a consonant are pluralized by replacing the 'y' with "ies". For example, allergy --> allergies. However, monkey --> monkeys.
I understand this proposal does not satisfy all plural scenarios. To do so would require much more work and support for irregular one-off cases. I've attached a patch containing the small change to DefaultRelationNameResolver as well as a unit test verifying the change in behavior.