public class Inflector extends Object
| 限定符和类型 | 类和说明 |
|---|---|
static class |
Inflector.Builder |
| 限定符和类型 | 方法和说明 |
|---|---|
static Inflector.Builder |
builder() |
String |
camelize(String word)
Converts string to Camel case.
|
String |
camelize(String word,
boolean firstLetterInLowerCase)
Converts string to Camel case.
|
String |
classify(String tableName)
Returns a entityClass class tableName corresponding to the input database
table tableName.
|
static Inflector.Builder |
createDefaultBuilder() |
static Inflector |
getInstance() |
String |
humanize(String phase)
Replaces all dashes and underscores by spaces and capitalizes the first
word.
|
String |
pluralize(String word) |
String |
singularize(String word) |
String |
tableize(String modelClassName)
Returns a database table tableName corresponding to the input entityClass class
tableName.
|
String |
titleize(String phase)
Replaces all dashes and underscores by spaces and capitalizes all the words.
|
String |
underscore(String phase)
underscore is the reverse of camelize method.
|
public static Inflector.Builder createDefaultBuilder()
public static Inflector getInstance()
public String classify(String tableName)
Examples:
classify("people") "Person"
classify("line_items") "LineItem"
tableName - java class tableName of the entityClasspublic String underscore(String phase)
Examples:
underscore("Hello world") "hello world"
underscore("ActiveRecord") "active_record"
underscore("The RedCross") "the red_cross"
underscore("ABCD") "abcd"
phase - the original stringpublic String titleize(String phase)
Examples:
titleize("ch 1: Java-ActiveRecordIsFun") "Ch 1: Java Active Record Is Fun"
phase - the original stringpublic String tableize(String modelClassName)
Examples:
tableize("Person") "people"
tableize("LineItem") "line_items"
modelClassName - public String humanize(String phase)
Examples:
humanize("active_record") "Active record"
humanize("post_id") "Post"
phase - the original stringpublic String camelize(String word)
word - the word to be converted to camelized formpublic String camelize(String word, boolean firstLetterInLowerCase)
Examples:
camelize("hello") "Hello"
camelize("hello world") "Hello world"
camelize("active_record") "ActiveRecord"
camelize("active_record", true) "activeRecord"
word - the word to be converted to camelized formfirstLetterInLowerCase - true if the first character should be in lower casepublic static Inflector.Builder builder()
Copyright © 2020 com.github.braisdom. All rights reserved.