public static Map < String , String > bundleToStringMap ( final ResourceBundle bundle , final String suffix ) { if ( bundle == null ) { return Collections . < String , String > emptyMap ( ) ; } String theSuffix ; if ( StringUtils . isEmpty ( suffix ) ) { theSuffix = "" ; } else { theSuffix = suffix + "." ; } Map < String , String > map = new LinkedHashMap < String , String > ( ) ; Enumeration < String > keys = bundle . getKeys ( ) ; while ( keys . hasMoreElements ( ) ) { String key = keys . nextElement ( ) ; Object value = bundle . getObject ( key ) ; String strValue = ( value != null ) ? value . toString ( ) : null ; map . put ( theSuffix + key , strValue ) ; } return map ; }
Converts a resource bundle to a map after prepending suffix + . to each property