jlibs.core.lang
Class Noun

java.lang.Object
  extended by jlibs.core.lang.Noun

public class Noun
extends Object

API for performing pluralization, singularization on various strings. These inflections will be useful in code generators that convert things like database table names into Java class names.


Constructor Summary
Noun()
           
 
Method Summary
static void addIrregular(String singular, String plural)
          Add the addSingular and addPlural forms of words that cannot be converted using the normal rules.
static void addPlural(String match, String rule)
          Add a match pattern and replacement rule for converting addPlural forms to addSingular forms.
static void addPlural(String match, String rule, boolean insensitive)
          Add a match pattern and replacement rule for converting addPlural forms to addSingular forms.
static void addSingular(String match, String rule)
          Add a match pattern and replacement rule for converting addSingular forms to addPlural forms.
static void addSingular(String match, String rule, boolean insensitive)
          Add a match pattern and replacement rule for converting addSingular forms to addPlural forms.
static void addUncountable(String word)
          Add a word that cannot be converted between addSingular and addPlural.
static String pluralize(String word)
          Return a addPlural version of the specified word.
static String singularize(String word)
          Return a addSingular version of the specified word.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Noun

public Noun()
Method Detail

addPlural

public static void addPlural(String match,
                             String rule)

Add a match pattern and replacement rule for converting addPlural forms to addSingular forms. By default, matches will be case insensitive.

Parameters:
match - Match pattern regular expression
rule - Replacement rule

addPlural

public static void addPlural(String match,
                             String rule,
                             boolean insensitive)

Add a match pattern and replacement rule for converting addPlural forms to addSingular forms.

Parameters:
match - Match pattern regular expression
rule - Replacement rule
insensitive - Flag indicating this match should be case insensitive

addSingular

public static void addSingular(String match,
                               String rule)

Add a match pattern and replacement rule for converting addSingular forms to addPlural forms. By default, matches will be case insensitive.

Parameters:
match - Match pattern regular expression
rule - Replacement rule

addSingular

public static void addSingular(String match,
                               String rule,
                               boolean insensitive)

Add a match pattern and replacement rule for converting addSingular forms to addPlural forms.

Parameters:
match - Match pattern regular expression
rule - Replacement rule
insensitive - Flag indicating this match should be case insensitive

addIrregular

public static void addIrregular(String singular,
                                String plural)

Add the addSingular and addPlural forms of words that cannot be converted using the normal rules.

Parameters:
singular - Singular form of the word
plural - Plural form of the word

addUncountable

public static void addUncountable(String word)

Add a word that cannot be converted between addSingular and addPlural.

Parameters:
word - Word to be added

pluralize

public static String pluralize(String word)

Return a addPlural version of the specified word.

Parameters:
word - Singular word to be converted

singularize

public static String singularize(String word)

Return a addSingular version of the specified word.

Parameters:
word - Plural word to be converted


Copyright © 2018. All rights reserved.