Browse Source

add PropertiesFileUtil

shuzheng 9 years ago
parent
commit
961be1c55d
1 changed files with 26 additions and 0 deletions
  1. 26 0
      common/src/main/java/com/zheng/common/util/PropertiesFileUtil.java

+ 26 - 0
common/src/main/java/com/zheng/common/util/PropertiesFileUtil.java

@@ -0,0 +1,26 @@
+package com.zheng.common.util;
+
+import java.util.ResourceBundle;
+
+/**
+ * 配置文件读取工具
+ *
+ * @author shuzheng
+ * @date 2016年10月15日
+ */
+public class PropertiesFileUtil {
+
+    private ResourceBundle resourceBundle = null;
+
+    public PropertiesFileUtil(String bundleFile) {
+        resourceBundle = ResourceBundle.getBundle(bundleFile);
+    }
+
+    public String getValue(String key) {
+        if (null == resourceBundle) {
+            return null;
+        }
+        return resourceBundle.getString(key);
+    }
+
+}