?? propertymanager.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 + -