public class Inflections extends Object
Inflections defines rules for singular, plural inflections.| Modifier and Type | Method and Description |
|---|---|
protected String |
apply(String word,
List<com.axelor.common.Inflections.Rule> rules)
Apply the given list of inflection rules on the provided word.
|
static Inflections |
getInstance()
Get the default instance of
Inflections for the English. |
static Inflections |
getInstance(String language)
Get the default instance of
Inflections for the given language. |
void |
ignore(String... words)
Add words to ignore for inflections.
|
void |
irregular(String singular,
String plural)
Add irregular singular, plural words.
|
void |
plural(String pattern,
String replacement)
Add rule for converting singular to plural.
|
String |
pluralize(String word)
Convert the given word to it's plural form.
|
void |
singular(String pattern,
String replacement)
Add rule for converting plurals to singular.
|
String |
singularize(String word)
Convert the given word to it's singular form.
|
public static Inflections getInstance()
Inflections for the English.Inflectionspublic static Inflections getInstance(String language)
Inflections for the given language.language - the languageInflectionspublic void ignore(String... words)
words - the words to ignore.public void irregular(String singular, String plural)
singular - the singular wordplural - the plural wordpublic void singular(String pattern, String replacement)
pattern - the pattern to match pluralreplacement - the replacement textpublic void plural(String pattern, String replacement)
pattern - the pattern to match singularreplacement - the replacement textprotected String apply(String word, List<com.axelor.common.Inflections.Rule> rules)
word - the word on which to apply the rulesrules - the inflection rulespublic String singularize(String word)
word - the word to convert