This is not possible for Java, because each element must be a valid identifier (and valid Java identifiers may not contain dashes).
The immediate task would be to add a custom property for each enumeration value or override the toString method, so you can do the following:
Test.EMPLOYEE_ID.getRealName() //Returns "employee-id" public enum Test EMPLOYEE_ID("employee-id"); private Test(String realName) { this.realName = realName; } public String getRealName() { return realName; } private final String realName; }
Daniel Rikowski
source share