Res.java
968 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package com.huaheng.common.constant;
import java.util.ResourceBundle;
public class Res {
    private static ResourceBundle dateBundle;
    private static ResourceBundle yearBundle;
    private static ResourceBundle batteryBundle;
    private Res() {
        bundle();
    }
    private static class StringBundleHolder {
        private static Res instance = new Res();
    }
    public static Res string() {
        return StringBundleHolder.instance;
    }
    public void bundle() {
        dateBundle = ResourceBundle.getBundle("productDateRes");
        yearBundle = ResourceBundle.getBundle("productYearRes");
        batteryBundle = ResourceBundle.getBundle("batteryRes");
    }
    public String dateKey(String key) {
        return dateBundle.getString(key);
    }
    public String yearKey(String key) {
        return yearBundle.getString(key);
    }
    public String batteryKey(String key) {
        return batteryBundle.getString(key);
    }
}