public enum WsOrderStatusEnum {
ORDER_STATUS_WAIT_PAY(0, "待支付"),
;
private final Integer code;
private final String info;
WsOrderStatusEnum(Integer code, String info) {
this.code = code;
this.info = info;
}
//根据code获取value
public static String getInfoByCode(Integer code) {
if (null != code)
{
for (WsOrderStatusEnum value : values()) {
if (value.getCode().equals(code)) {
return value.getInfo();
}
}
}
return "未知";
}
public Integer getCode() {
return code;
}
public String getInfo() {
return info;
}
}
java 定义枚举类enum
猜你喜欢
转载自blog.csdn.net/qq_37741426/article/details/129851661
今日推荐
周排行