Class JKNameConvertor

java.lang.Object
com.jk.core.util.JKNameConvertor

public class JKNameConvertor extends Object
This class provides utility methods for converting and manipulating names and strings.
Version:
1.0
Author:
Dr. Jalal H. Kiswani
  • Constructor Details

    • JKNameConvertor

      public JKNameConvertor()
  • Method Details

    • convertJavaNameToEntityName

      public static String convertJavaNameToEntityName(Class<?> clas)
      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

      public static String convertJavaNameToEntityName(Field field)
      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

      public static String convertJavaNameToEntityName(String javaName)
      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

      public static String convertToCamelCaseWithCapFirst(String string)
      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

      public static String convertToCamelCaseWithSmallFirst(String name)
      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

      public static String convertToCamelCase(String name, boolean firstCap)
      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

      public static String convertToLowerCaseWitheUnderScores(String name)
      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

      public static void main(String[] args)
      The main method used for class demonstration.
      Parameters:
      args - the command-line arguments.
    • convertToLowerWithDashed

      public static String convertToLowerWithDashed(String name)
      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

      public static String convertToTitle(String name)
      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

      public 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.
      Parameters:
      name - Specifies the input string to be converted.
      Returns:
      the string converted to a package name format.
    • convertToLowerCaseWitheDashes

      public static String convertToLowerCaseWitheDashes(String name)
      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

      public static String convertToLowerCaseWithoutSpaces(String name)
      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

      public static String convertToUpperCaseWitheUnderScores(String name)
      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

      public static String toStartWithSmall(String text)
      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.