static String nameConvert(String name, boolean mapCamelCaseToUnderscore) {
    if (!mapCamelCaseToUnderscore)
      return name;
    StringBuilder sbd = new StringBuilder();
    char prevChar = name.charAt(0);
    sbd.append(Character.toLowerCase(prevChar));
    for (int i = 1, len = name.length(); i < len; i++) {
      char c = name.charAt(i);
      if (Character.isUpperCase(c)) {
        int next = i + 1;
        char nextChar = (next < len) ? name.charAt(next) : '\0';
        if (Character.isLowerCase(prevChar) || Character.isLowerCase(nextChar)) {
          sbd.append('_');
        }
        sbd.append(Character.toLowerCase(c));
      } else {
        sbd.append(c);
      }
      prevChar = c;
    }
    return sbd.toString();
  }
static String nameConvert ( String name , boolean mapCamelCaseToUnderscore ) { if ( ! mapCamelCaseToUnderscore ) return name ; StringBuilder sbd = new StringBuilder ( ) ; char prevChar = name . charAt ( 0 ) ; sbd . append ( Character . toLowerCase ( prevChar ) ) ; for ( int i = 1 , len = name . length ( ) ; i < len ; i ++ ) { char c = name . charAt ( i ) ; if ( Character . isUpperCase ( c ) ) { int next = i + 1 ; char nextChar = ( next < len ) ? name . charAt ( next ) : '\0' ; if ( Character . isLowerCase ( prevChar ) || Character . isLowerCase ( nextChar ) ) { sbd . append ( '_' ) ; } sbd . append ( Character . toLowerCase ( c ) ) ; } else { sbd . append ( c ) ; } prevChar = c ; } return sbd . toString ( ) ; }
将当前的类名转换成数据库表名或者列名。
例如：Blog -> blog， HTTPClient -> http_client, BlogAuthor -> blog_author

@return 转换后的名字