public enum FormEnum {
AAAAA(10,"AAA","ASASA"),
BBBBB(24,"BBB","BBBBB");
private int id;
private String code;
private String name;
FormEnum(int id, String code, String name) {
this.id = id;
this.code = code;
this.name = name;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public static String getNameById(int id) {
FormEnum[] values = FormEnum.values();
for (FormEnum temp : values) {
if (id == temp.id) {
return temp.name;
}
}
return null;
}
}
java定义枚举
最新推荐文章于 2024-04-18 19:27:44 发布