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)
The camel case version of the string with the first letter in lower case. 
 | 
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 | 
getterNameFor(String propertyName,
             boolean isBoolean)
Get the equivalent getter name for the given property. 
 | 
static String | 
getterNameFor(String propertyName,
             Class<?> type)
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 | 
isEnvironmentName(String str)
Checks whether the string is a valid environment-style property name. 
 | 
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 boolean | 
isValidHyphenatedPropertyName(String str)
Checks whether the string is a valid hyphenated (kebab-case) property 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 setter@Nonnull public static String setterNameFor(@Nonnull String propertyName)
propertyName - The property namepublic static boolean isGetterName(String methodName)
methodName - The method namepublic static String getPropertyNameForGetter(String getterName)
getterName - The getter@Nonnull public static String getterNameFor(@Nonnull String propertyName)
propertyName - The property name@Nonnull public static String getterNameFor(@Nonnull String propertyName, @Nonnull Class<?> type)
propertyName - The property nametype - The type of the propertypublic static String getterNameFor(@Nonnull String propertyName, boolean isBoolean)
propertyName - The property nameisBoolean - Is the property a booleanpublic 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 casepublic static String filename(String path)
path - The path of the filepublic static boolean isValidHyphenatedPropertyName(String str)
str - The string to checkpublic static boolean isEnvironmentName(String str)
str - The string to check