无法访问课堂外的枚举键

时间:2017-09-22 07:09:18

标签: java enums java-8 code-readability

以下是我的助手提供者类

    public class HP<T> implements javax.inject.Provider<T> {
   private static Map<KEY, Object> helperMap = new HashMap<>();

    public static void setHelper(KEY helper, Object helperObject) {
        helperMap.put(helper, helperObject);
    }

        public static enum KEY {
            POLICY_HELPER, MILES_HELPER;
        }
    }

我正在初始化地图

class AAAA{
static {
initHelperProviderMap();
}
    private static void initHelperProviderMap() {
            HP.KEY. **//Unable to access enum KEY's key POLICY_HELPER etc** 
            HP.setHelper(HP.KEY.??, helperObject);


        }

这里HP.KEY.POLICY_HELPER是我无法访问的。你能建议任何解决方案吗?

0 个答案:

没有答案