I see this question
but I need to define a lot of enum type and do a lot of duplicate work, can every enum extends some thing? like this:
public static enum Type {
;
public final int value;
Type(int v) {
this.value = v;
}
public static Type fromInt(int v) {
for (Type type : values()) {
if (type.value == v) {
return type;
}
}
return null;
}
}
public static enum ENUM1 extends Type{
A(1), B(5), C(10);
}
public static enum ENUM2 extends Type{
D(1), E(20), F(30);
}