码迷,mamicode.com
首页 > 编程语言 > 详细

Java 枚举

时间:2018-12-08 13:34:12      阅读:188      评论:0      收藏:0      [点我收藏+]

标签:final   static   枚举   color   nbsp   ring   启动   ati   oid   

 

import java.util.HashMap;
import java.util.Map;

public enum CheckStatus {

    NO_SUBMIT(0,"未提审"),

    CHECKING(1, "审批中"),

    REFUSED(2,"已驳回"),

    THROUGH(3,"已通过");

    public static Map<Integer,String> statusMap=new HashMap(){{
        put(NO_SUBMIT.getKey(), NO_SUBMIT.getValue());
        put(CHECKING.getKey(), CHECKING.getValue());
        put(REFUSED.getKey(), REFUSED.getValue());
        put(THROUGH.getKey(), THROUGH.getValue());
    }};

    private int key;

    private String value;

    CheckStatus(int key,String value){
        this.key = key;
        this.value = value;
    }
    public int getKey() {
        return key;
    }

    public void setKey(int key) {
        this.key = key;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }
    
}

 

 

public enum CheckOp {
    /**启动流程*/
    PROCESS_START(0),

    /**任务办理*/
    PROCESS_TASK_FINISH(1),

    /**任务驳回*/
    PROCESS_TASK_ROLLBACK(2);

    private final int value;

    CheckOp(int value) {
        this.value = value;
    }

    public int getValue() {
        return value;
    }


}

 

Java 枚举

标签:final   static   枚举   color   nbsp   ring   启动   ati   oid   

原文地址:https://www.cnblogs.com/guchunchao/p/10087069.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!