@Test public void testSingularize() throws Exception { assertEquals("friend", Inflector.getInstance().singularize("friends")); assertEquals("potato", Inflector.getInstance().singularize("potatoes")); assertEquals("child", Inflector.getInstance().singularize("children")); }
public String singularize(Object word) { if (word == null) return null; String wordStr = word.toString().trim(); if (wordStr.length() == 0) return wordStr; if (isUncountable(wordStr)) return wordStr; for (Rule rule : this.singulars) { String result = rule.apply(wordStr); if (result != null) return result; } return wordStr; }
Inflector { public String singularize(Object word) { if (word == null) return null; String wordStr = word.toString().trim(); if (wordStr.length() == 0) return wordStr; if (isUncountable(wordStr)) return wordStr; for (Rule rule : this.singulars) { String result = rule.apply(wordStr); if (result != null) return result; } return wordStr; } }
Inflector { public String singularize(Object word) { if (word == null) return null; String wordStr = word.toString().trim(); if (wordStr.length() == 0) return wordStr; if (isUncountable(wordStr)) return wordStr; for (Rule rule : this.singulars) { String result = rule.apply(wordStr); if (result != null) return result; } return wordStr; } Inflector(); protected  Inflector(Inflector original); }
Inflector { public String singularize(Object word) { if (word == null) return null; String wordStr = word.toString().trim(); if (wordStr.length() == 0) return wordStr; if (isUncountable(wordStr)) return wordStr; for (Rule rule : this.singulars) { String result = rule.apply(wordStr); if (result != null) return result; } return wordStr; } Inflector(); protected  Inflector(Inflector original); static Inflector getInstance(); String pluralize(Object word); String pluralize(Object word,
                            int count); String singularize(Object word); String lowerCamelCase(String lowerCaseAndUnderscoredWord,
                                 char... delimiterChars); String upperCamelCase(String lowerCaseAndUnderscoredWord,
                                 char... delimiterChars); String camelCase(String lowerCaseAndUnderscoredWord,
                            boolean uppercaseFirstLetter,
                            char... delimiterChars); String underscore(String camelCaseWord,
                             char... delimiterChars); String capitalize(String words); String humanize(String lowerCaseAndUnderscoredWords,
                           String... removableTokens); String titleCase(String words,
                            String... removableTokens); String ordinalize(int number); boolean isUncountable(String word); Set<String> getUncountables(); void addPluralize(String rule,
                             String replacement); void addSingularize(String rule,
                               String replacement); void addIrregular(String singular,
                             String plural); void addUncountable(String... words); void clear(); }
Inflector { public String singularize(Object word) { if (word == null) return null; String wordStr = word.toString().trim(); if (wordStr.length() == 0) return wordStr; if (isUncountable(wordStr)) return wordStr; for (Rule rule : this.singulars) { String result = rule.apply(wordStr); if (result != null) return result; } return wordStr; } Inflector(); protected  Inflector(Inflector original); static Inflector getInstance(); String pluralize(Object word); String pluralize(Object word,
                            int count); String singularize(Object word); String lowerCamelCase(String lowerCaseAndUnderscoredWord,
                                 char... delimiterChars); String upperCamelCase(String lowerCaseAndUnderscoredWord,
                                 char... delimiterChars); String camelCase(String lowerCaseAndUnderscoredWord,
                            boolean uppercaseFirstLetter,
                            char... delimiterChars); String underscore(String camelCaseWord,
                             char... delimiterChars); String capitalize(String words); String humanize(String lowerCaseAndUnderscoredWords,
                           String... removableTokens); String titleCase(String words,
                            String... removableTokens); String ordinalize(int number); boolean isUncountable(String word); Set<String> getUncountables(); void addPluralize(String rule,
                             String replacement); void addSingularize(String rule,
                               String replacement); void addIrregular(String singular,
                             String plural); void addUncountable(String... words); void clear();  }