public class NameUtils
extends java.lang.Object
Naming convention utilities.
| Constructor and Description | 
|---|
NameUtils()  | 
| Modifier and Type | Method and Description | 
|---|---|
static java.lang.String | 
camelCase(java.lang.String str)
The camel case version of the string with the first letter in lower case. 
 | 
static java.lang.String | 
camelCase(java.lang.String str,
         boolean lowerCaseFirstLetter)
The camel case version of the string with the first letter in lower case. 
 | 
static java.lang.String | 
capitalize(java.lang.String name)
Converts a property name to class name according to the JavaBean convention. 
 | 
static java.lang.String | 
decapitalize(java.lang.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 java.lang.String | 
decapitalizeWithoutSuffix(java.lang.String name,
                         java.lang.String... suffixes)
Converts class name to property name using JavaBean decapitalization. 
 | 
static java.lang.String | 
dehyphenate(java.lang.String name)
Converts hyphenated, lower-case form to camel-case form. 
 | 
static java.lang.String | 
environmentName(java.lang.String camelCase)
Returns the underscore separated version of the given camel case string. 
 | 
static java.lang.String | 
extension(java.lang.String filename)
Retrieves the extension of a file name. 
 | 
static java.lang.String | 
filename(java.lang.String path)
Retrieves the fileName of a file without extension. 
 | 
static java.lang.String | 
getPackageName(java.lang.String className)
Returns the package name for a class represented as string. 
 | 
static java.lang.String | 
getPropertyNameForGetter(java.lang.String getterName)
Get the equivalent property name for the given getter. 
 | 
static java.lang.String | 
getPropertyNameForSetter(java.lang.String setterName)
Get the equivalent property name for the given setter. 
 | 
static java.lang.String | 
getSimpleName(java.lang.String className)
Returns the simple name for a class represented as string. 
 | 
static java.lang.String | 
getterNameFor(java.lang.String propertyName)
Get the equivalent getter name for the given property. 
 | 
static java.lang.String | 
getterNameFor(java.lang.String propertyName,
             boolean isBoolean)
Get the equivalent getter name for the given property. 
 | 
static java.lang.String | 
getterNameFor(java.lang.String propertyName,
             java.lang.Class<?> type)
Get the equivalent getter name for the given property. 
 | 
static java.lang.String | 
hyphenate(java.lang.String name)
Converts camel case to hyphenated, lowercase form. 
 | 
static java.lang.String | 
hyphenate(java.lang.String name,
         boolean lowerCase)
Converts camel case to hyphenated, lowercase form. 
 | 
static boolean | 
isEnvironmentName(java.lang.String str)
Checks whether the string is a valid environment-style property name. 
 | 
static boolean | 
isGetterName(java.lang.String methodName)
Is the given method name a valid getter name. 
 | 
static boolean | 
isHyphenatedLowerCase(java.lang.String name)
Checks whether the given name is a valid service identifier. 
 | 
static boolean | 
isSetterName(java.lang.String methodName)
Is the given method name a valid setter name. 
 | 
static boolean | 
isValidHyphenatedPropertyName(java.lang.String str)
Checks whether the string is a valid hyphenated (kebab-case) property name. 
 | 
static java.lang.String | 
setterNameFor(java.lang.String propertyName)
Get the equivalent setter name for the given property. 
 | 
static java.lang.String | 
trimSuffix(java.lang.String string,
          java.lang.String... suffixes)
Trims the given suffixes. 
 | 
static java.lang.String | 
underscoreSeparate(java.lang.String camelCase)
Returns the underscore separated version of the given camel case string. 
 | 
public static boolean isHyphenatedLowerCase(java.lang.String name)
name - The namepublic static java.lang.String decapitalizeWithoutSuffix(java.lang.String name,
                                                         java.lang.String... suffixes)
name - The class namesuffixes - The suffix to removepublic static java.lang.String trimSuffix(java.lang.String string,
                                          java.lang.String... suffixes)
string - The string to trimsuffixes - The suffixespublic static java.lang.String capitalize(java.lang.String name)
name - The property namepublic static java.lang.String hyphenate(java.lang.String name)
name - The namepublic static java.lang.String hyphenate(java.lang.String name,
                                         boolean lowerCase)
name - The namelowerCase - Whether the result should be converted to lower casepublic static java.lang.String dehyphenate(java.lang.String name)
name - The hyphenated stringpublic static java.lang.String getPackageName(java.lang.String className)
className - The class namepublic static java.lang.String underscoreSeparate(java.lang.String camelCase)
camelCase - The camel case namepublic static java.lang.String environmentName(java.lang.String camelCase)
camelCase - The camel case namepublic static java.lang.String getSimpleName(java.lang.String className)
className - The class namepublic static boolean isSetterName(java.lang.String methodName)
methodName - The method namepublic static java.lang.String getPropertyNameForSetter(java.lang.String setterName)
setterName - The setter@NonNull public static java.lang.String setterNameFor(@NonNull java.lang.String propertyName)
propertyName - The property namepublic static boolean isGetterName(java.lang.String methodName)
methodName - The method namepublic static java.lang.String getPropertyNameForGetter(java.lang.String getterName)
getterName - The getter@NonNull public static java.lang.String getterNameFor(@NonNull java.lang.String propertyName)
propertyName - The property name@NonNull public static java.lang.String getterNameFor(@NonNull java.lang.String propertyName, @NonNull java.lang.Class<?> type)
propertyName - The property nametype - The type of the propertypublic static java.lang.String getterNameFor(@NonNull java.lang.String propertyName, boolean isBoolean)
propertyName - The property nameisBoolean - Is the property a booleanpublic static java.lang.String decapitalize(java.lang.String name)
name - The String to decapitalizepublic static java.lang.String extension(java.lang.String filename)
filename - The name of the filepublic static java.lang.String camelCase(java.lang.String str)
str - The stringpublic static java.lang.String camelCase(java.lang.String str,
                                         boolean lowerCaseFirstLetter)
str - The stringlowerCaseFirstLetter - Whether the first letter is in upper case or lower casepublic static java.lang.String filename(java.lang.String path)
path - The path of the filepublic static boolean isValidHyphenatedPropertyName(java.lang.String str)
str - The string to checkpublic static boolean isEnvironmentName(java.lang.String str)
str - The string to check