public static String convertClassNameToUnderscoreName ( String name ) { StringBuilder result = new StringBuilder ( ) ; if ( name != null ) { int len = name . length ( ) ; if ( len > 0 ) { result . append ( name . charAt ( 0 ) ) ; for ( int i = 1 ; i < len ; i ++ ) { if ( true == Character . isUpperCase ( name . charAt ( i ) ) ) { result . append ( ' ' ) ; } result . append ( name . charAt ( i ) ) ; } } } return result . toString ( ) . toUpperCase ( ) ; }
Convert a class name with underscores to the corresponding column name using _ . A name like CustomerNumber class name would match a CUSTOMER_NUMBER .