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 StringApply the given list of inflection rules on the provided word.static InflectionsGet the default instance ofInflectionsfor the English language.static InflectionsgetInstance(String language) Get the default instance ofInflectionsfor the given language.voidAdd words to ignore for inflections.voidAdd irregular singular, plural words.voidAdd rule for converting singular to plural.Convert the given word to it's plural form.voidAdd 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 ofInflectionsfor the English language.- Returns:
- an instance of
Inflections
-
getInstance
Get the default instance ofInflectionsfor 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
-