private static String extractPropertyName ( Method method , String prefix ) { String name = method . getName ( ) ; if ( ! name . startsWith ( prefix ) ) { return null ; } if ( name . length ( ) == prefix . length ( ) ) { return "" ; } name = name . substring ( prefix . length ( ) ) ; if ( ! Character . isUpperCase ( name . charAt ( 0 ) ) || name . indexOf ( ' ' ) >= 0 ) { return null ; } // Decapitalize the name only if it doesn't begin with two uppercase // letters. if ( name . length ( ) == 1 || ! Character . isUpperCase ( name . charAt ( 1 ) ) ) { char chars [ ] = name . toCharArray ( ) ; chars [ 0 ] = Character . toLowerCase ( chars [ 0 ] ) ; name = new String ( chars ) ; } return name . intern ( ) ; }
Returns null if prefix pattern doesn t match