public class NameUtils extends Object
Naming convention utilities.
| Constructor and Description | 
|---|
NameUtils()  | 
| Modifier and Type | Method and Description | 
|---|---|
static String | 
camelCase(String str)
The camel case version of the string with the first letter in lower case. 
 | 
static String | 
camelCase(String str,
         boolean lowerCaseFirstLetter)
. 
 | 
static String | 
capitalize(String name)
Converts a property name to class name according to the JavaBean convention. 
 | 
static String | 
decapitalize(String name)
Decapitalizes a given string according to the rule:
 
 If the first or only character is Upper Case, it is made Lower Case
 UNLESS the second character is also Upper Case, when the String is
 returned unchanged  
 | 
static String | 
decapitalizeWithoutSuffix(String name,
                         String... suffixes)
Converts class name to property name using JavaBean decapitalization. 
 | 
static String | 
dehyphenate(String name)
Converts hyphenated, lower-case form to camel-case form. 
 | 
static String | 
environmentName(String camelCase)
Returns the underscore separated version of the given camel case string. 
 | 
static String | 
extension(String filename)
Retrieves the extension of a file name. 
 | 
static String | 
filename(String path)
Retrieves the fileName of a file without extension. 
 | 
static String | 
getPackageName(String className)
Returns the package name for a class represented as string. 
 | 
static String | 
getPropertyNameForGetter(String getterName)
Get the equivalent property name for the given getter. 
 | 
static String | 
getPropertyNameForSetter(String setterName)
Get the equivalent property name for the given setter. 
 | 
static String | 
getSimpleName(String className)
Returns the simple name for a class represented as string. 
 | 
static String | 
getterNameFor(String propertyName)
Get the equivalent getter name for the given property. 
 | 
static String | 
hyphenate(String name)
Converts camel case to hyphenated, lowercase form. 
 | 
static String | 
hyphenate(String name,
         boolean lowerCase)
Converts camel case to hyphenated, lowercase form. 
 | 
static boolean | 
isGetterName(String methodName)
Is the given method name a valid getter name. 
 | 
static boolean | 
isHyphenatedLowerCase(String name)
Checks whether the given name is a valid service identifier. 
 | 
static boolean | 
isSetterName(String methodName)
Is the given method name a valid setter name. 
 | 
static String | 
setterNameFor(String propertyName)
Get the equivalent setter name for the given property. 
 | 
static String | 
trimSuffix(String string,
          String... suffixes)
Trims the given suffixes. 
 | 
static String | 
underscoreSeparate(String camelCase)
Returns the underscore separated version of the given camel case string. 
 | 
public static boolean isHyphenatedLowerCase(String name)
name - The namepublic static String decapitalizeWithoutSuffix(String name, String... suffixes)
name - The class namesuffixes - The suffix to removepublic static String trimSuffix(String string, String... suffixes)
string - The string to trimsuffixes - The suffixespublic static String capitalize(String name)
name - The property namepublic static String hyphenate(String name)
name - The namepublic static String hyphenate(String name, boolean lowerCase)
name - The namelowerCase - Whether the result should be converted to lower casepublic static String dehyphenate(String name)
name - The hyphenated stringpublic static String getPackageName(String className)
className - The class namepublic static String underscoreSeparate(String camelCase)
camelCase - The camel case namepublic static String environmentName(String camelCase)
camelCase - The camel case namepublic static String getSimpleName(String className)
className - The class namepublic static boolean isSetterName(String methodName)
methodName - The method namepublic static String getPropertyNameForSetter(String setterName)
setterName - The setterpublic static String setterNameFor(String propertyName)
propertyName - The property namepublic static boolean isGetterName(String methodName)
methodName - The method namepublic static String getPropertyNameForGetter(String getterName)
getterName - The getterpublic static String getterNameFor(String propertyName)
propertyName - The property namepublic static String decapitalize(String name)
name - The String to decapitalizepublic static String extension(String filename)
filename - The name of the filepublic static String camelCase(String str)
str - The stringpublic static String camelCase(String str, boolean lowerCaseFirstLetter)
str - The stringlowerCaseFirstLetter - Whether the first letter is in upper case or lower case