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.
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.getLabelFromRb("IslemTipi.ILK_KRLM");
Also, a style tip is to rename private final String name;
(or remove it if you don't need it) since it is confusing when seen next to Enum.name()
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.