I am using an enumeration class in my GWT client\'s code to define a set of types.
public enum MyType {
FIRST_TYPE(\"first\"), SECOND_TYPE(\"second\"), THIR
I managed to solve the problem by using GWT's ConstantsWithLookup
interface.
Here is the solution:
MyType.java
public enum MyType {
FIRST_TYPE, SECOND_TYPE, THIRD_TYPE;
private final MyConstantsWithLookup constants = GWT.create(MyConstantsWithLookup.class)
public String getTitle() {
return this.constants.getString(this.name());
}
}
MyConstantsWithLookup.java
public interface MyConstantsWithLookup extends ConstantsWithLookup {
String FIRST_TYPE();
String SECOND_TYPE();
String THIRD_TYPE();
}
MyConstantsWithLookup.properties
FIRST_TYPE = first
SECOND_TYPE = second
THIRD_TYPE = third