Simple Resource Bundle based on Java code
import java.util.Enumeration; import java.util.ResourceBundle; import java.util.MissingResourceException; public class SimpleResourceBundleExample { public static void main(String [] argv) { try { ResourceBundle rb = ResourceBundle.getBundle("SimpleResourceBundle"); System.out.println(rb.getString("AMMessage")); System.out.println(rb.getString("PMMessage")); } catch (MissingResourceException mre) { mre.printStackTrace(); } } } /////// import java.util.Enumeration; import java.util.ResourceBundle; import java.util.StringTokenizer; public class SimpleResourceBundle extends ResourceBundle { private String keys = "AMMessage PMMessage"; public Object handleGetObject(String key) { if (key.equals("AMMessage")) return "Good morning"; if (key.equals("PMMessage")) return "Good evening"; return null; } public Enumeration getKeys() { StringTokenizer keyTokenizer = new StringTokenizer(keys); return keyTokenizer; } }