package com.evideostb.billsystem.properties; import java.io.IOException; import java.util.ResourceBundle; /** * 读取错误提示信息 * @author zhangchuanzhao * 2015-10-10 上午11:22:44 */ public class ErrorMessageReader { private static ErrorMessageReader errorMessageReader = null; private static ResourceBundle rb = null; //properties文件名 private final static String RESOURCE_NAME = "errorMessage"; /** * private避免被实例化,从而实现单一实例 * @throws IOException */ private ErrorMessageReader(){ rb = ResourceBundle.getBundle(RESOURCE_NAME); } /** * 获取单一实例 * @return * @throws IOException */ public static ErrorMessageReader getInstance() throws IOException{ if(errorMessageReader == null){ synchronized (DbConfigProperties.class) { if(errorMessageReader == null){ errorMessageReader = new ErrorMessageReader(); } } } return errorMessageReader; } /** * 通过key获取value * @param key * @return */ public String getValue(String key){ return rb.getString(key); } }
时间: 2024-10-10 03:49:47