@Test public void testToSQLName() { Assert.assertEquals("test", NamingUtil.toSQLName("Test")); Assert.assertEquals("test", NamingUtil.toSQLName("test")); Assert.assertEquals("test_codes", NamingUtil.toSQLName("TestCodes")); Assert.assertEquals("test_codes", NamingUtil.toSQLName("testCodes")); Assert.assertEquals("test_codes_form5", NamingUtil.toSQLName("TestCodesForm5")); Assert.assertEquals("", NamingUtil.toSQLName("")); }
public static String toSQLName(String name) { if (StringUtil.isEmpty(name)) { return ""; } StringBuilder buffer = new StringBuilder(); int startIndex = 0; for (int i=0; i<name.length();i++) { if (name.charAt(i) >= 'A' && name.charAt(i)<= 'Z') { if (startIndex!=0) { buffer.append("_"); } buffer.append(name.substring(startIndex, i).toLowerCase()); startIndex = i; } } if (startIndex<name.length()) { if (startIndex!=0) { buffer.append("_"); } buffer.append(name.substring(startIndex).toLowerCase()); } return buffer.toString(); }
NamingUtil { public static String toSQLName(String name) { if (StringUtil.isEmpty(name)) { return ""; } StringBuilder buffer = new StringBuilder(); int startIndex = 0; for (int i=0; i<name.length();i++) { if (name.charAt(i) >= 'A' && name.charAt(i)<= 'Z') { if (startIndex!=0) { buffer.append("_"); } buffer.append(name.substring(startIndex, i).toLowerCase()); startIndex = i; } } if (startIndex<name.length()) { if (startIndex!=0) { buffer.append("_"); } buffer.append(name.substring(startIndex).toLowerCase()); } return buffer.toString(); } }
NamingUtil { public static String toSQLName(String name) { if (StringUtil.isEmpty(name)) { return ""; } StringBuilder buffer = new StringBuilder(); int startIndex = 0; for (int i=0; i<name.length();i++) { if (name.charAt(i) >= 'A' && name.charAt(i)<= 'Z') { if (startIndex!=0) { buffer.append("_"); } buffer.append(name.substring(startIndex, i).toLowerCase()); startIndex = i; } } if (startIndex<name.length()) { if (startIndex!=0) { buffer.append("_"); } buffer.append(name.substring(startIndex).toLowerCase()); } return buffer.toString(); } private  NamingUtil(); }
NamingUtil { public static String toSQLName(String name) { if (StringUtil.isEmpty(name)) { return ""; } StringBuilder buffer = new StringBuilder(); int startIndex = 0; for (int i=0; i<name.length();i++) { if (name.charAt(i) >= 'A' && name.charAt(i)<= 'Z') { if (startIndex!=0) { buffer.append("_"); } buffer.append(name.substring(startIndex, i).toLowerCase()); startIndex = i; } } if (startIndex<name.length()) { if (startIndex!=0) { buffer.append("_"); } buffer.append(name.substring(startIndex).toLowerCase()); } return buffer.toString(); } private  NamingUtil(); static String toLabel(String name); static String toGetterName(String name); static String toSetterName(String name); static String toAttributeName(String name); static String toElementName(String name); static String toDisplayName(String name); static String toSQLName(String name); static String getPropertyName(String methodName); static String getSimpleName(String qualifiedName); static String getPackageName(String qualifiedName); }
NamingUtil { public static String toSQLName(String name) { if (StringUtil.isEmpty(name)) { return ""; } StringBuilder buffer = new StringBuilder(); int startIndex = 0; for (int i=0; i<name.length();i++) { if (name.charAt(i) >= 'A' && name.charAt(i)<= 'Z') { if (startIndex!=0) { buffer.append("_"); } buffer.append(name.substring(startIndex, i).toLowerCase()); startIndex = i; } } if (startIndex<name.length()) { if (startIndex!=0) { buffer.append("_"); } buffer.append(name.substring(startIndex).toLowerCase()); } return buffer.toString(); } private  NamingUtil(); static String toLabel(String name); static String toGetterName(String name); static String toSetterName(String name); static String toAttributeName(String name); static String toElementName(String name); static String toDisplayName(String name); static String toSQLName(String name); static String getPropertyName(String methodName); static String getSimpleName(String qualifiedName); static String getPackageName(String qualifiedName);  }