首页 > 代码库 > 枚举类应用

枚举类应用

package com.tz.core;
/**
 * 枚举类
 * @author Administrator
 * 使用:ErrorMsgEnum.ERR_1000.getDiscription();
 */
public enum ErrorMsgEnum {
 
    ERR_1000("1000","中间价为空"),
    ERR_1001("1001","获取黄金基准价异常"),
    ERR_1002("1002","获取黄金基准价异常"),
    ERR_1003("1003","获取黄金基准价异常"),
    ERR_1004("1004","获取黄金基准价异常"),
    ERR_1005("1005","获取黄金基准价异常");
    
    private String key;
    private String discription;
    public String getKey() {
        return key;
    }
    
    public String getDiscription() {
        return discription;
    }
    
    private ErrorMsgEnum(){
        
    }
    
    private ErrorMsgEnum(String key,String discription){
        this.key = key;
        this.discription = discription;
    }
}

 

枚举类应用