您的位置:首页 > 编程语言 > Java开发

java枚举类型

2016-03-17 17:28 561 查看
package com.idomov.comm.conf;

public enum Audit {

全部(0,"全部"),审核通过(1,"审核通过"),审核失败(2,"审核失败"),待审核(3,"待审核");

private final Integer value;
private final String ladel;

private Audit(Integer value,String ladel) {
this.value = value;
this.ladel = ladel;
}

public String getLadel() {
return ladel;
}

public Integer getValue() {
return value;
}

public static Audit valueOf(Integer value) {
switch (value) {
case 0:
return Audit.全部;
case 1:
return Audit.审核通过;
case 2:
return Audit.审核失败;
case 3:
return Audit.待审核;
default:
throw null;
}
}

public static Audit ladelOf(String ladel) {
switch (ladel) {
case "全部":
return Audit.全部;
case "审核通过":
return Audit.审核通过;
case "审核失败":
return Audit.审核失败;
case "待审核":
return Audit.待审核;
default:
throw null;
}
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: