[英]Can't find resource for bundle java.util.PropertyResourceBundle ENUM
I have enum and used it to combo box. 我有枚举并将其用于组合框。 However some of them seems with'-' and some of them seems without'-'.
但是,其中一些似乎带有“-”,而有些似乎没有“-”。 And strings with '-' gave Can't find resource for bundle java.util.PropertyResourceBundle error.
带有'-'的字符串给出了找不到包java.util.PropertyResourceBundle错误的资源。
public enum IslemTipi {
ILK_KRLM,
KOK_SRTFKA_VE_ANHTR_CFI_URTMI,
ISLM_KAYDI_SORGLMA,
YTKISZ_VERI_TBNI_MDHLE_TRMSI;
private final String name;
private IslemTipi() {
this.name = null;
}
public String getName() {
return ResourceBundleUtil.getLabelFromRb("IslemTipi." + name());
}
}
public IslemTipi[] getIslemTipiValues() {
return IslemTipi.values();
}
The problem likely lies in your ResourceBundleUtil
code - try to run the code below and resolve the source of the Exception. 问题可能出在您的
ResourceBundleUtil
代码中-尝试运行下面的代码并解决Exception的来源。
ResourceBundleUtil.getLabelFromRb("IslemTipi.ILK_KRLM");
Also, a style tip is to rename private final String name;
另外,一个样式提示是重命名
private final String name;
(or remove it if you don't need it) since it is confusing when seen next to Enum.name()
. (或在不需要时将其删除),因为当在
Enum.name()
旁边看到它时会造成混乱。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.