public enum NeAdminRventLogTypeEnum {
ONE(1,"one"),
TWO(2,"two"),
THREE(3,"three"),
FOUR(4,"four")
,
;
private int code;
private String text;
private NeAdminRventLogTypeEnum(String text){
this.code = this.ordinal();
this.text = text;
}
public int toCode(){
return this.code;
}
public String toText(){
return this.text;
}
public static NeAdminRventLogTypeEnum fromCode(int code){
if(code < NeAdminRventLogTypeEnum.values().length){
return NeAdminRventLogTypeEnum.values()[code];
} else {
throw new RuntimeException("Enum code out of bounds");
}
}
public static NeAdminRventLogTypeEnum fromText(String text){
for (NeAdminRventLogTypeEnum value : NeAdminRventLogTypeEnum.values()) {
if(value.text.equals(text)){
return value;
}
}
throw new RuntimeException("Enum text not found");
}
}