public enum ECheckState {
T_CHECKED("1", "已审核")
, T_NO_CHECK("0", "未审核");
// 成员变量
private String code;
private String value;
private ECheckState(String code, String value) {
this.code = code;
this.value = value;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
// 普通方法
public static String getValue(String code) {
for (ECheckState c : ECheckState.values()) {
if (c.getCode().equals(code)) {
return c.value;
}
}
return null;
}
}
使用方法
ECheckState.T_CHECKED.getCode获取code