记录个枚举

public enum PayServiceEnum {
    ALIPAY("ALIPAY","支付宝"),
    WECHAT("WECHAT","微信支付"),
    UNIONPAY("UNIONPAY","银联支付");
   private String code;
   private String desc;

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    PayServiceEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static PayServiceEnum getByCode(String code){
        for (PayServiceEnum value : PayServiceEnum.values()) {
            if(value.getCode().equals(code)){
                return value;
            }
        }
        return  null;
    }
}

 

posted @ 2019-08-20 11:34  不死码农  阅读(132)  评论(0编辑  收藏  举报