⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 propertymanager.java

📁 一个基于Eclipse平台和MySQL数据库的一个超市管理系统功能全面
💻 JAVA
字号:
package com.xdf.supermarket.util;

import java.util.MissingResourceException;
import java.util.ResourceBundle;

/**
 * @author hdyu
 *
 * To change the template for this generated type comment go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
public class PropertyManager {
	private static final String CONFIG = "config";
	private static final ResourceBundle RESOURCE_BUNDLE =
		ResourceBundle.getBundle(CONFIG);
	/**
	 * 读取默认的config.properties文件
	 * @param key 
	 * @return value
	 */
	public static String getString(String key) {
		try {
			return RESOURCE_BUNDLE.getString(key);
		} catch (MissingResourceException e) {
			throw new RuntimeException( "! config : "+ key + '!');
		}
	}
	/**
	 * 读取指定为rb.properties文件
	 * @param rb property 文件,文件名为 rb.properties
	 * @param key 
	 * @return value
	 */
	public static String getRB(String rb, String key) throws Exception{
		try {
			return ResourceBundle.getBundle(rb).getString(key);
		} catch (MissingResourceException e) {
			throw new RuntimeException( '!' + rb + ":" + key + '!');
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -