Package com.jk.core.util
Class JKNameConvertor
java.lang.Object
com.jk.core.util.JKNameConvertor
This class provides utility methods for converting and manipulating names and
strings.
- Version:
- 1.0
- Author:
- Dr. Jalal H. Kiswani
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
convertJavaNameToEntityName
(Class<?> clas) This method converts a Java class name to an entity name based on naming conventions.static String
convertJavaNameToEntityName
(Field field) This method converts a Java field name to an entity name based on naming conventions.static String
convertJavaNameToEntityName
(String javaName) This method converts a Java name to an entity name based on naming conventions.static String
convertToCamelCase
(String name, boolean firstCap) This method converts a given string to camel case, optionally capitalizing the first character.static String
convertToCamelCaseWithCapFirst
(String string) This method converts a given string to camel case with the first character in upper-case.static String
This method converts a given string to camel case with the first character in lower-case.static String
This method converts a given string to lower-case with dashes replacing spaces and special characters removed.static String
This method converts a given string to lower-case with underscores replacing spaces and special characters.static String
This method converts a given string to lower-case with spaces removed.static String
This method converts a given string to lower-case with spaces replaced by dashes and special characters removed.static String
convertToPackageName
(String name) This method converts a given string to a package name format by removing spaces and underscores and converting to lower-case.static String
convertToTitle
(String name) This method converts a given string to title case.static String
This method converts a given string to upper-case with underscores replacing spaces and special characters removed.static void
The main method used for class demonstration.static String
toStartWithSmall
(String text) This method converts a given string to start with a lower-case character.
-
Constructor Details
-
JKNameConvertor
public JKNameConvertor()
-
-
Method Details
-
convertJavaNameToEntityName
This method converts a Java class name to an entity name based on naming conventions.- Parameters:
clas
- Specifies the Java class for which to convert the name.- Returns:
- the converted entity name.
-
convertJavaNameToEntityName
This method converts a Java field name to an entity name based on naming conventions.- Parameters:
field
- Specifies the Java field for which to convert the name.- Returns:
- the converted entity name.
-
convertJavaNameToEntityName
This method converts a Java name to an entity name based on naming conventions.- Parameters:
javaName
- Specifies the Java name to be converted.- Returns:
- the converted entity name.
-
convertToCamelCaseWithCapFirst
This method converts a given string to camel case with the first character in upper-case.- Parameters:
string
- Specifies the string to be converted.- Returns:
- the string converted to camel case with the first character capitalized.
-
convertToCamelCaseWithSmallFirst
This method converts a given string to camel case with the first character in lower-case.- Parameters:
name
- Specifies the input string to be converted.- Returns:
- the string converted to camel case with the first character in lower-case.
-
convertToCamelCase
This method converts a given string to camel case, optionally capitalizing the first character.- Parameters:
name
- Specifies the input string to be converted.firstCap
- Indicates whether the first character should be capitalized.- Returns:
- the string converted to camel case.
-
convertToLowerCaseWitheUnderScores
This method converts a given string to lower-case with underscores replacing spaces and special characters.- Parameters:
name
- Specifies the input string to be converted.- Returns:
- the string converted to lower-case with underscores.
-
main
The main method used for class demonstration.- Parameters:
args
- the command-line arguments.
-
convertToLowerWithDashed
This method converts a given string to lower-case with spaces replaced by dashes and special characters removed.- Parameters:
name
- Specifies the input string to be converted.- Returns:
- the string converted to lower-case with dashes.
-
convertToTitle
This method converts a given string to title case.- Parameters:
name
- Specifies the input string to be converted.- Returns:
- the string converted to title case.
-
convertToPackageName
This method converts a given string to a package name format by removing spaces and underscores and converting to lower-case.- Parameters:
name
- Specifies the input string to be converted.- Returns:
- the string converted to a package name format.
-
convertToLowerCaseWitheDashes
This method converts a given string to lower-case with dashes replacing spaces and special characters removed.- Parameters:
name
- Specifies the input string to be converted.- Returns:
- the string converted to lower-case with dashes.
-
convertToLowerCaseWithoutSpaces
This method converts a given string to lower-case with spaces removed.- Parameters:
name
- Specifies the input string to be converted.- Returns:
- the string converted to lower-case without spaces.
-
convertToUpperCaseWitheUnderScores
This method converts a given string to upper-case with underscores replacing spaces and special characters removed.- Parameters:
name
- Specifies the input string to be converted.- Returns:
- the string converted to upper-case with underscores.
-
toStartWithSmall
This method converts a given string to start with a lower-case character.- Parameters:
text
- Specifies the input string to be converted.- Returns:
- the string with the first character in lower-case.
-