Package com.axelor.common
Class Inflections
java.lang.Object
com.axelor.common.Inflections
The
Inflections
defines rules for singular, plural inflections.-
Method Summary
Modifier and TypeMethodDescriptionprotected String
Apply the given list of inflection rules on the provided word.static Inflections
Get the default instance ofInflections
for the English language.static Inflections
getInstance
(String language) Get the default instance ofInflections
for the given language.void
Add words to ignore for inflections.void
Add irregular singular, plural words.void
Add rule for converting singular to plural.Convert the given word to it's plural form.void
Add rule for converting plurals to singular.singularize
(String word) Convert the given word to it's singular form.
-
Method Details
-
getInstance
Get the default instance ofInflections
for the English language.- Returns:
- an instance of
Inflections
-
getInstance
Get the default instance ofInflections
for the given language.- Parameters:
language
- the language- Returns:
- an instance of
Inflections
-
ignore
Add words to ignore for inflections.- Parameters:
words
- the words to ignore.
-
irregular
Add irregular singular, plural words.- Parameters:
singular
- the singular wordplural
- the plural word
-
singular
Add rule for converting plurals to singular.- Parameters:
pattern
- the pattern to match pluralreplacement
- the replacement text
-
plural
Add rule for converting singular to plural.- Parameters:
pattern
- the pattern to match singularreplacement
- the replacement text
-
apply
Apply the given list of inflection rules on the provided word.- Parameters:
word
- the word on which to apply the rulesrules
- the inflection rules- Returns:
- the inflected text
-
singularize
Convert the given word to it's singular form.- Parameters:
word
- the word to convert- Returns:
- the converted text
-
pluralize
Convert the given word to it's plural form.- Parameters:
word
- the word to convert- Returns:
- the converted text
-