public static String quoteIdentifier(String s){
  if (s == null || s.length() == 0) {
    return "\"\"";
  }
  char c=s.charAt(0);
  if ((!Character.isLetter(c) && c != '_') || Character.isLowerCase(c)) {
    return StringUtils.quoteIdentifier(s);
  }
  for (int i=1, length=s.length(); i < length; i++) {
    c=s.charAt(i);
    if ((!Character.isLetterOrDigit(c) && c != '_') || Character.isLowerCase(c)) {
      return StringUtils.quoteIdentifier(s);
    }
  }
  if (isKeyword(s,true)) {
    return StringUtils.quoteIdentifier(s);
  }
  return s;
}

public static String quoteIdentifier ( String s ) { if ( s == null || s . length ( ) == 0 ) { return "\"\"" ; } char c = s . charAt ( 0 ) ; if ( ( ! Character . isLetter ( c ) && c != '_' ) || Character . isLowerCase ( c ) ) { return StringUtils . quoteIdentifier ( s ) ; } for ( int i = 1 , length = s . length ( ) ; i < length ; i ++ ) { c = s . charAt ( i ) ; if ( ( ! Character . isLetterOrDigit ( c ) && c != '_' ) || Character . isLowerCase ( c ) ) { return StringUtils . quoteIdentifier ( s ) ; } } if ( isKeyword ( s , true ) ) { return StringUtils . quoteIdentifier ( s ) ; } return s ; }
add double quotes around an identifier if required .
