public static String encodeAttributeName(String name) { String result; if(name.toUpperCase().equals(name)) { result = name.toLowerCase(); } else { result = name; } result = deleteWithPascalNotation(result, '_'); result = encodeJavaIdentifier(result); if(Character.isUpperCase(result.charAt(0))) { result = Character.toLowerCase(result.charAt(0)) + result.substring(1); } if (reservedKeywords.contains(result)) { result = "_" + result; } return result; }
public static String encodeAttributeName(String name) { String result; if(name.toUpperCase().equals(name)) { result = name.toLowerCase(); } else { result = name; } result = deleteWithPascalNotation(result, '_'); result = encodeJavaIdentifier(result); if(Character.isUpperCase(result.charAt(0))) { result = Character.toLowerCase(result.charAt(0)) + result.substring(1); } if (reservedKeywords.contains(result)) { result = "_" + result; } return result; }
public static String encodeAttributeName(String name) { String result; if(name.toUpperCase().equals(name)) { result = name.toLowerCase(); } else { result = name; } result = deleteWithPascalNotation(result, '_'); result = encodeJavaIdentifier(result); if(Character.isUpperCase(result.charAt(0))) { result = Character.toLowerCase(result.charAt(0)) + result.substring(1); } if (reservedKeywords.contains(result)) { result = "_" + result; } return result; }
public static String encodeAttributeName(String name) { String result; if(name.toUpperCase().equals(name)) { result = name.toLowerCase(); } else { result = name; } result = deleteWithPascalNotation(result, '_'); result = encodeJavaIdentifier(result); if(Character.isUpperCase(result.charAt(0))) { result = Character.toLowerCase(result.charAt(0)) + result.substring(1); } if (reservedKeywords.contains(result)) { result = "_" + result; } return result; }
/** * Encodes a String into standard java class name convention. The following steps are performed * on the name: * 1. First character is set to upper case. * 2. Illegal characters like '-' and whitespace are removed. * * @param name the original class name. * @return the class name complying with standard java class name convention. * @throws IllegalNameException when class name is a reserved keyword in java. */ public static String encodeClassName(String name) throws IllegalNameException { String result = name; if (name.toUpperCase().equals(name)) { StringBuilder nameRebuilder = new StringBuilder(); nameRebuilder.append(name.toLowerCase()); nameRebuilder.setCharAt(0, name.charAt(0)); result = nameRebuilder.toString(); } result = deleteWithPascalNotation(result, '_'); result = encodeJavaIdentifier(result); if(Character.isLowerCase(result.charAt(0))) { result = Character.toUpperCase(result.charAt(0)) + result.substring(1); } assertLegalName(result); return result; }
/** * Encodes a String into standard java class name convention. The following steps are performed * on the name: * 1. First character is set to upper case. * 2. Illegal characters like '-' and whitespace are removed. * * @param name the original class name. * @return the class name complying with standard java class name convention. * @throws IllegalNameException when class name is a reserved keyword in java. */ public static String encodeClassName(String name) throws IllegalNameException { String result = name; if (name.toUpperCase().equals(name)) { StringBuilder nameRebuilder = new StringBuilder(); nameRebuilder.append(name.toLowerCase()); nameRebuilder.setCharAt(0, name.charAt(0)); result = nameRebuilder.toString(); } result = deleteWithPascalNotation(result, '_'); result = encodeJavaIdentifier(result); if(Character.isLowerCase(result.charAt(0))) { result = Character.toUpperCase(result.charAt(0)) + result.substring(1); } assertLegalName(result); return result; }
/** * Encodes a String into standard java class name convention. The following steps are performed * on the name: * 1. First character is set to upper case. * 2. Illegal characters like '-' and whitespace are removed. * * @param name the original class name. * @return the class name complying with standard java class name convention. * @throws IllegalNameException when class name is a reserved keyword in java. */ public static String encodeClassName(String name) throws IllegalNameException { String result = name; if (name.toUpperCase().equals(name)) { StringBuilder nameRebuilder = new StringBuilder(); nameRebuilder.append(name.toLowerCase()); nameRebuilder.setCharAt(0, name.charAt(0)); result = nameRebuilder.toString(); } result = deleteWithPascalNotation(result, '_'); result = encodeJavaIdentifier(result); if(Character.isLowerCase(result.charAt(0))) { result = Character.toUpperCase(result.charAt(0)) + result.substring(1); } assertLegalName(result); return result; }
/** * Encodes a String into standard java class name convention. The following steps are performed * on the name: * 1. First character is set to upper case. * 2. Illegal characters like '-' and whitespace are removed. * * @param name the original class name. * @return the class name complying with standard java class name convention. * @throws IllegalNameException when class name is a reserved keyword in java. */ public static String encodeClassName(String name) throws IllegalNameException { String result = name; if (name.toUpperCase().equals(name)) { StringBuilder nameRebuilder = new StringBuilder(); nameRebuilder.append(name.toLowerCase()); nameRebuilder.setCharAt(0, name.charAt(0)); result = nameRebuilder.toString(); } result = deleteWithPascalNotation(result, '_'); result = encodeJavaIdentifier(result); if(Character.isLowerCase(result.charAt(0))) { result = Character.toUpperCase(result.charAt(0)) + result.substring(1); } assertLegalName(result); return result; }