【发布时间】:2011-11-30 21:57:25
【问题描述】:
由于我们的特殊需要,我不得不继承 ResourceBundle。
但是,要覆盖getKeys(),我有点麻烦。这个getKeys 需要以某种方式从底层ResourceBundles 的映射中连接起来。我该怎么做?
谢谢
编辑:提交时我遇到了一个想法。基本上我们每个Module 和ResourceBundle 都有,所以到目前为止我的代码如下所示:
public Enumeration<String> getKeys() {
ArrayList<String> keys = new ArrayList<String>();
for (Map.Entry<Module, ResourceBundle> entry : internalMap.entrySet()) {
Enumeration<String> tmp = entry.getValue().getKeys();
while (tmp.hasMoreElements()) {
String key = tmp.nextElement();
keys.add(key);
}
}
return Collections.enumeration(keys);
}
【问题讨论】:
标签: java resourcebundle