Java Properties convertBundleToProperties(ResourceBundle rb)

Here you can find the source of convertBundleToProperties(ResourceBundle rb)

Description

Method to convert a ResourceBundle to a Properties object.

License

Apache License

Parameter

Parameter Description
rb a given resource bundle

Return

Properties a populated properties object

Declaration

public static Properties convertBundleToProperties(ResourceBundle rb) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.*;

public class Main {
    /**/*from   ww w . jav  a2s .c  o m*/
     * Method to convert a ResourceBundle to a Properties object.
     *
     * @param rb a given resource bundle
     * @return Properties a populated properties object
     */
    public static Properties convertBundleToProperties(ResourceBundle rb) {
        Properties props = new Properties();

        for (Enumeration<String> keys = rb.getKeys(); keys.hasMoreElements();) {
            String key = keys.nextElement();
            props.put(key, rb.getString(key));
        }

        return props;
    }
}

Related

  1. convertResourceBundleToProperties(ResourceBundle resource)
  2. createScriptBodyFromScriptSet(Properties scriptSet)
  3. differentKeys(Properties p1, Properties p2)
  4. equalProps(Properties p1, Properties p2)