|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.javalite.common.Inflector
public class Inflector
| Constructor Summary | |
|---|---|
Inflector()
|
|
| Method Summary | |
|---|---|
static void |
addIrregular(String rule,
String replacement)
|
static void |
addPlural(String rule,
String replacement)
|
static void |
addSingular(String rule,
String replacement)
|
static String |
camelize(String underscore)
Generates a camel case version of a phrase from underscore. |
static String |
camelize(String underscore,
boolean capitalizeFirstChar)
Generates a camel case version of a phrase from underscore. |
static String |
capitalize(String word)
Capitalizes a word - only a first character is converted to upper case. |
static String |
getIdName(String tableName)
|
static String |
getOtherName(String source,
String target)
If a table name is made of two other table names (as is typical for many to many relationships), this method retrieves a name of "another" table from a join table name. |
static String |
gsub(String word,
String rule,
String replacement)
Replaces a found pattern in a word and returns a transformed word. |
static String |
pluralize(String word)
|
static String |
shortName(String className)
Deprecated. Use clazz.getSimpleName() instead of Inflector.shortName(clazz.getName()). |
static String |
singularize(String word)
|
static String |
tableize(String camelCase)
Converts a camel case to underscore and then pluralizes. |
static String |
underscore(String camel)
Converts a CamelCase string to underscores: "AliceInWonderLand" becomes: "alice_in_wonderland" |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Inflector()
| Method Detail |
|---|
public static void addPlural(String rule,
String replacement)
public static void addSingular(String rule,
String replacement)
public static void addIrregular(String rule,
String replacement)
public static String gsub(String word,
String rule,
String replacement)
word - rule - replacement -
public static String pluralize(String word)
public static String singularize(String word)
public static String tableize(String camelCase)
camelCase - any CamelCase phrase.
public static String underscore(String camel)
camel - camel case input
public static String camelize(String underscore)
underscore - underscore version of a word to converted to camel case.
public static String camelize(String underscore,
boolean capitalizeFirstChar)
underscore - underscore version of a word to converted to camel case.capitalizeFirstChar - set to true if first character needs to be capitalized, false if not.
public static String capitalize(String word)
word - word/phrase to capitalize.
@Deprecated public static String shortName(String className)
public static String getIdName(String tableName)
public static String getOtherName(String source,
String target)
source - known table name. It may or may not exist in the target table name.target - this is a potential "join" table name.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||